class ConfigurationError(Exception): pass class AuthError(Exception): def __init__(self, error, status_code=401): self.error = error self.status_code = status_code class InvalidInputError(Exception): def __init__(self, error, status_code=400): self.error = error self.status_code = status_code class ApplicationError(Exception): """Generic application error for covering any unhandled exceptions""" def __init__(self, error, status_code=500): self.error = error self.status_code = status_code class DataNotFoundError(Exception): """ Examples: raise DataNotFoundError({ 'code': Codes.data_not_found.value, 'description': 'Data matching the specified query parameters was not found.' }) """ def __init__(self, error, status_code=404): self.error = error self.status_code = status_code class DynamoDBQueryError(Exception): def __init__(self, error, status_code=500): self.error = error self.status_code = status_code class S3QueryError(Exception): def __init__(self, error, status_code=500): self.error = error self.status_code = status_code class RangeError(Exception): """Used for invalid ranges (e.g.: start < end)""" def __init__(self, error, status_code=400): self.error = error self.status_code = status_code class InvalidDataError(Exception): """The data does not match what we expected""" class MissingRequiredParameterError(Exception): """Missing a required parameter. This is an internal exception for developers only."""