rbtools.api.errors¶
Error classes and codes for API communication.
Functions
|
Create an error instance. |
Exceptions
|
An error communicating with the API. |
|
Authorization error when communicating with the API. |
|
Bad request data made to an API. |
An exception for caching errors. |
|
|
A non-API error when communicating with a server. |
|
An error communicating over SSL or verifying an SSL certificate. |
- exception rbtools.api.errors.APIError(http_status: int | None = None, error_code: int | None = None, rsp: JSONDict | None = None, message: str | None = None, *args, **kwargs)[source]¶
Bases:
ExceptionAn error communicating with the API.
- __firstlineno__ = 148¶
- __init__(http_status: int | None = None, error_code: int | None = None, rsp: JSONDict | None = None, message: str | None = None, *args, **kwargs) None[source]¶
Initialize the error.
- Parameters:
http_status (
int, optional) –The HTTP status code associated with this error.
Changed in version 3.1: This is now optional.
error_code (
int, optional) –The API error code associated with this error.
Changed in version 3.1: This is now optional.
rsp (
dict, optional) – The API response payload. This may beNonefor non-API Error payloads.message (
str, optional) –A specific error message to use. This will take precedence over any errors in
rsp.Added in version 3.1.
*args (
tuple) – Extra positional arguments to pass to the base constructor.**kwargs (
dict) – Extra keyword arguments to pass to the base constructor.
- __static_attributes__ = ('error_code', 'http_status', 'message', 'rsp')¶
- __str__() str[source]¶
Return a string representation of the error.
The explicit
messagepassed to the constructor will be used if provided. If not provided, this will fall back to the message in thersppayload, or todefault_message.If an API error code is available, it will be included in the message. If one is not provided, but an HTTP status is available, then it will be included instead.
- Returns:
The error message.
- Return type:
- exception rbtools.api.errors.AuthorizationError(http_status: int | None = None, error_code: int | None = None, rsp: JSONDict | None = None, message: str | None = None, *args, **kwargs)[source]¶
Bases:
APIErrorAuthorization error when communicating with the API.
- __firstlineno__ = 276¶
- __static_attributes__ = ()¶
- exception rbtools.api.errors.BadRequestError(http_status: int | None = None, error_code: int | None = None, rsp: JSONDict | None = None, message: str | None = None, *args, **kwargs)[source]¶
Bases:
APIErrorBad request data made to an API.
- __firstlineno__ = 282¶
- __static_attributes__ = ()¶
- exception rbtools.api.errors.CacheError[source]¶
Bases:
ExceptionAn exception for caching errors.
- __firstlineno__ = 313¶
- __static_attributes__ = ()¶
- exception rbtools.api.errors.ServerInterfaceError(msg: str, *args, **kwargs)[source]¶
Bases:
ExceptionA non-API error when communicating with a server.
- __annotations_cache__ = {}¶
- __firstlineno__ = 317¶
- __static_attributes__ = ('msg',)¶
- exception rbtools.api.errors.ServerInterfaceSSLError(*, host: str, port: int, ssl_error: SSLError, ssl_context: SSLContext)[source]¶
Bases:
ServerInterfaceErrorAn error communicating over SSL or verifying an SSL certificate.
This class wraps a
ssl.SSLErroror subclass, and attempts to generate a helpful error message with instructions for resolving most common SSL-related issues.Added in version 4.1.
- __firstlineno__ = 351¶
- __init__(*, host: str, port: int, ssl_error: SSLError, ssl_context: SSLContext) None[source]¶
Initialize the error.
- Parameters:
host (
str) – The hostname RBTools attempted to connect to.port (
int) – The port RBTools attempted to connect to.ssl_error (
ssl.SSLError) – The original SSL error.ssl_context (
ssl.SSLContext) – The original SSL context.
- __static_attributes__ = ('host', 'port', 'ssl_context', 'ssl_error')¶
- ssl_context: SSLContext¶