Skip to content

Exceptions

ClientSetupError

Bases: QuickApiException

An error setting up the BaseClient subclass.

Source code in quickapi/exceptions.py
Python
 5
 6
 7
 8
 9
10
class ClientSetupError(QuickApiException):
    """An error setting up the BaseClient subclass."""

    def __init__(self, attribute: str):
        message = f"Subclass setup error. Missing or invalid required attribute `{attribute}`."
        super().__init__(message)

DictDeserializationError

Bases: QuickApiException

Dict deserialization failed.

Source code in quickapi/exceptions.py
Python
31
32
33
34
35
36
37
38
class DictDeserializationError(QuickApiException):
    """Dict deserialization failed."""

    expected_type = ""

    def __init__(self, expected_type: str):
        self.expected_type = expected_type
        super().__init__(self.__doc__)

DictSerializationError

Bases: QuickApiException

Dict serialization failed.

Source code in quickapi/exceptions.py
Python
21
22
23
24
25
26
27
28
class DictSerializationError(QuickApiException):
    """Dict serialization failed."""

    expected_type = ""

    def __init__(self, expected_type: str):
        self.expected_type = expected_type
        super().__init__(self.__doc__)

HTTPError

Bases: QuickApiException

The response received a non 200 response status code.

Source code in quickapi/exceptions.py
Python
13
14
15
16
17
18
class HTTPError(QuickApiException):
    """The response received a non `200` response status code."""

    def __init__(self, status_code: int):
        message = f"HTTP request received a non `HTTP 200 (OK)` response. The response status code was `{status_code}`."
        super().__init__(message)

MissingDependencyError

Bases: QuickApiException

Trying to use an optional dependency without installing it first.

Source code in quickapi/exceptions.py
Python
59
60
61
62
63
64
65
66
67
class MissingDependencyError(QuickApiException):
    """Trying to use an optional dependency without installing it first."""

    def __init__(self, dependency: str):
        message = (
            f"Using an optional dependecy without installing it first `{dependency}`."
            f"Please install the dependency using `pip install quickapiclient[{dependency}]`."
        )
        super().__init__(message)

QuickApiException

Bases: Exception

A QuickApi exception has occurred.

Source code in quickapi/exceptions.py
Python
1
2
class QuickApiException(Exception):
    """A QuickApi exception has occurred."""

RequestSerializationError

Bases: QuickApiException

The request was not serializable to the configured type.

Source code in quickapi/exceptions.py
Python
49
50
51
52
53
54
55
56
class RequestSerializationError(QuickApiException):
    """The request was not serializable to the configured type."""

    def __init__(self, expected_type: str):
        message = (
            f"HTTP request params/body did not match expected type `{expected_type}`."
        )
        super().__init__(message)

ResponseSerializationError

Bases: QuickApiException

The response received was not serializable to the configured response_body type.

Source code in quickapi/exceptions.py
Python
41
42
43
44
45
46
class ResponseSerializationError(QuickApiException):
    """The response received was not serializable to the configured `response_body` type."""

    def __init__(self, expected_type: str):
        message = f"HTTP response body did not match expected type `{expected_type}`."
        super().__init__(message)