followthemoney.exc

 1from typing import Dict, Optional, TypedDict
 2
 3
 4class ErrorSpec(TypedDict, total=False):
 5    properties: Dict[str, str]
 6
 7
 8class FollowTheMoneyException(Exception):
 9    """Catch-all exception for errors emitted by this library."""
10
11    pass
12
13
14class InvalidData(FollowTheMoneyException):
15    """Schema validation errors will be caught by the API."""
16
17    def __init__(self, message: str, errors: Optional[ErrorSpec] = None) -> None:
18        super(InvalidData, self).__init__(message)
19        self.errors: ErrorSpec = errors or {}
20
21
22class InvalidModel(FollowTheMoneyException):
23    """The schema model is not defined correctly."""
24
25    pass
26
27
28class InvalidMapping(FollowTheMoneyException):
29    """A data mapping was invalid."""
30
31    pass
class ErrorSpec(typing.TypedDict):
5class ErrorSpec(TypedDict, total=False):
6    properties: Dict[str, str]
properties: Dict[str, str]
class FollowTheMoneyException(builtins.Exception):
 9class FollowTheMoneyException(Exception):
10    """Catch-all exception for errors emitted by this library."""
11
12    pass

Catch-all exception for errors emitted by this library.

class InvalidData(FollowTheMoneyException):
15class InvalidData(FollowTheMoneyException):
16    """Schema validation errors will be caught by the API."""
17
18    def __init__(self, message: str, errors: Optional[ErrorSpec] = None) -> None:
19        super(InvalidData, self).__init__(message)
20        self.errors: ErrorSpec = errors or {}

Schema validation errors will be caught by the API.

InvalidData(message: str, errors: Optional[ErrorSpec] = None)
18    def __init__(self, message: str, errors: Optional[ErrorSpec] = None) -> None:
19        super(InvalidData, self).__init__(message)
20        self.errors: ErrorSpec = errors or {}
errors: ErrorSpec
class InvalidModel(FollowTheMoneyException):
23class InvalidModel(FollowTheMoneyException):
24    """The schema model is not defined correctly."""
25
26    pass

The schema model is not defined correctly.

class InvalidMapping(FollowTheMoneyException):
29class InvalidMapping(FollowTheMoneyException):
30    """A data mapping was invalid."""
31
32    pass

A data mapping was invalid.