ad842ee8a5
- Added type hinting (for now, 3.5-compatible) - Split `db` namespace into `db` module and `model` namespace - Changed elastic search to be created lazily for each operation - Changed to class based approach in entity serialization to allow stronger typing - Removed `required` argument from `context.get_*` family of functions; now it's implied if `default` argument is omitted - Changed `unalias_dict` implementation to use less magic inputs
58 lines
869 B
Python
58 lines
869 B
Python
from typing import Dict
|
|
|
|
|
|
class BaseError(RuntimeError):
|
|
def __init__(
|
|
self,
|
|
message: str='Unknown error',
|
|
extra_fields: Dict[str, str]=None) -> None:
|
|
super().__init__(message)
|
|
self.extra_fields = extra_fields
|
|
|
|
|
|
class ConfigError(BaseError):
|
|
pass
|
|
|
|
|
|
class AuthError(BaseError):
|
|
pass
|
|
|
|
|
|
class IntegrityError(BaseError):
|
|
pass
|
|
|
|
|
|
class ValidationError(BaseError):
|
|
pass
|
|
|
|
|
|
class SearchError(BaseError):
|
|
pass
|
|
|
|
|
|
class NotFoundError(BaseError):
|
|
pass
|
|
|
|
|
|
class ProcessingError(BaseError):
|
|
pass
|
|
|
|
|
|
class MissingRequiredFileError(ValidationError):
|
|
pass
|
|
|
|
|
|
class MissingOrExpiredRequiredFileError(MissingRequiredFileError):
|
|
pass
|
|
|
|
|
|
class MissingRequiredParameterError(ValidationError):
|
|
pass
|
|
|
|
|
|
class InvalidParameterError(ValidationError):
|
|
pass
|
|
|
|
|
|
class ThirdPartyError(BaseError):
|
|
pass
|