2017-02-04 00:08:12 +00:00
|
|
|
from typing import Dict
|
|
|
|
|
|
|
|
|
2016-09-10 08:14:40 +00:00
|
|
|
class BaseError(RuntimeError):
|
2017-02-04 00:08:12 +00:00
|
|
|
def __init__(
|
|
|
|
self,
|
2017-04-24 21:30:53 +00:00
|
|
|
message: str = 'Unknown error',
|
|
|
|
extra_fields: Dict[str, str] = None) -> None:
|
2016-09-10 08:14:40 +00:00
|
|
|
super().__init__(message)
|
|
|
|
self.extra_fields = extra_fields
|
|
|
|
|
|
|
|
|
|
|
|
class ConfigError(BaseError):
|
2016-08-14 12:22:53 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2016-09-10 08:14:40 +00:00
|
|
|
class AuthError(BaseError):
|
2016-08-14 12:22:53 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2016-09-10 08:14:40 +00:00
|
|
|
class IntegrityError(BaseError):
|
2016-08-14 12:22:53 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2016-09-10 08:14:40 +00:00
|
|
|
class ValidationError(BaseError):
|
2016-08-14 12:22:53 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2016-09-10 08:14:40 +00:00
|
|
|
class SearchError(BaseError):
|
2016-08-14 12:22:53 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2016-09-10 08:14:40 +00:00
|
|
|
class NotFoundError(BaseError):
|
2016-08-14 12:22:53 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
2016-09-10 08:14:40 +00:00
|
|
|
class ProcessingError(BaseError):
|
2016-08-14 12:22:53 +00:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class MissingRequiredFileError(ValidationError):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2017-01-07 10:59:43 +00:00
|
|
|
class MissingOrExpiredRequiredFileError(MissingRequiredFileError):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
2016-08-14 12:22:53 +00:00
|
|
|
class MissingRequiredParameterError(ValidationError):
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
class InvalidParameterError(ValidationError):
|
|
|
|
pass
|
2017-02-02 17:21:21 +00:00
|
|
|
|
|
|
|
|
|
|
|
class ThirdPartyError(BaseError):
|
|
|
|
pass
|