Source code for chainalysis.exceptions

[docs] class DataSolutionsSDKException(Exception): """Base class for SDK exceptions."""
[docs] def __init__( self, message=None, status_code=0, ): super().__init__(message) self.status_code = status_code
[docs] def get_exception(self): return self
[docs] class BadRequest(DataSolutionsSDKException): """Exception for Bad Request."""
[docs] def __init__(self, message="Bad Request"): super().__init__( message, status_code=400, )
[docs] class UnauthorizedException(DataSolutionsSDKException): """Exception for 401 Unauthorized."""
[docs] def __init__(self, message="Unauthorized. Check your API Key."): super().__init__( message, status_code=401, )
[docs] class ForbiddenException(DataSolutionsSDKException): """Exception for 403 Forbidden."""
[docs] def __init__( self, message="Forbidden. Contact Data Solutions if you believe you should have access to this endpoint/data.", ): super().__init__( message, status_code=403, )
[docs] class ValueException(DataSolutionsSDKException): """Exception for the API returning an unexpected response."""
[docs] def __init__(self, message="Invalid selection was made."): super().__init__( message, status_code=400, )
[docs] class NotFoundException(DataSolutionsSDKException): """Exception for 404 Not Found."""
[docs] def __init__(self, message="Not Found. Is your query correct?"): super().__init__( message, status_code=404, )
[docs] class InternalServerException(DataSolutionsSDKException): """Exception for 500 Internal Server Error."""
[docs] def __init__(self, message="Internal Server Error"): super().__init__( message, status_code=500, )
[docs] class RateLimitExceededException(DataSolutionsSDKException): """Exception for 429 Rate Limit Exceeded."""
[docs] def __init__(self, message="Rate Limit Exceeded."): super().__init__( message, status_code=429, )
[docs] class DataSolutionsAPIException(DataSolutionsSDKException): """Exception for the API returning an unexpected response."""
[docs] def __init__(self, message="Unexpected response from the API."): super().__init__( message, status_code=501, )
[docs] class UnhandledException(DataSolutionsSDKException): """Unhandled exception."""
[docs] def __init__( self, message="An unhandled exception occured. Please contact the Data Solutions Team.", details="", ): super().__init__((message, details))