Skip to content

Errors

async_boto.core.errors

ClientError

Bases: Exception

Raised when an API does not return a statuscode < 300

ErrorFactory

create_exception staticmethod

create_exception(name, message, api_response)
Source code in async_boto/core/errors.py
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
@staticmethod
def create_exception(name, message, api_response):
    return type(
        name,
        (ClientError,),
        {
            "__init__": lambda self, msg=message: super(
                self.__class__, self
            ).__init__(msg),
            "message": message,
            "error_type": name,
            "response": api_response,
        },
    )

raise_error_from_json staticmethod

raise_error_from_json(api_response)
Source code in async_boto/core/errors.py
23
24
25
26
27
28
29
30
@staticmethod
def raise_error_from_json(api_response: dict):
    error_type = api_response.get("__type", "GenericException").split("#")[-1]
    message = api_response.get("message", api_response)

    exc = ErrorFactory.create_exception(error_type, message, api_response)
    exc_obj = exc(message)
    raise exc_obj