provenaclient.utils.exceptions

Created Date: Thursday May 30th 2024 +1000 Author: Peter Baker —– Last Modified: Thursday May 30th 2024 10:17:36 am +1000 Modified By: Peter Baker —– Description: Defines a collection of exceptions produced by the Provena Client, extending a common base handled exception. —– HISTORY: Date By Comments ———- — ———————————————————

Exceptions

BaseException

A custom exception class that inherits from python's base exception.

CustomTimeoutException

An exception raised when a timeout occurs during an HTTP request.

BadRequestException

An exception raised for HTTP 400 Bad Request errors.

NotFoundException

An exception raised for HTTP 404 Not found exceptions.

AuthException

An exception raised for HTTP 401 Unauthorized errors.

HTTPValidationException

An exception raised for HTTP 422 Unprocessable Entity errors.

ServerException

An exception raised for HTTP 500+ Server Error responses.

ValidationException

An exception that is raised for validation/parsing

Module Contents

exception provenaclient.utils.exceptions.BaseException(message: str, error_code: int | None = None, payload: str | None = None)[source]

Bases: Exception

A custom exception class that inherits from python’s base exception.

Parameters:

Exception (Exception) – Exception class provided by python.

message: str
error_code: int | None
payload: str | None
__str__() str[source]

Creates a string of the BaseException

Returns:

A string describing the exception, including the message, error code, and payload if present.

Return type:

str

exception provenaclient.utils.exceptions.CustomTimeoutException(message: str, url: str | None)[source]

Bases: httpx.TimeoutException

An exception raised when a timeout occurs during an HTTP request.

Parameters:

BaseException – A custom exception class that inherits from python’s base exception and takes more parameters.

message
url
__str__() str[source]

An exception raised when a timeout occurs during an HTTP request.

Returns:

Returns a string that includes both the error message and the URL related to the timeout, if provided.

Return type:

str

exception provenaclient.utils.exceptions.BadRequestException(message: str, error_code: int | None = None, payload: str | None = None)[source]

Bases: BaseException

An exception raised for HTTP 400 Bad Request errors.

Parameters:

BaseException – A custom exception class that inherits from python’s base exception and takes more parameters.

exception provenaclient.utils.exceptions.NotFoundException(message: str, error_code: int | None = None, payload: str | None = None)[source]

Bases: BaseException

An exception raised for HTTP 404 Not found exceptions.

Parameters:

BaseException – A custom exception class that inherits from python’s base exception and takes more parameters.

exception provenaclient.utils.exceptions.AuthException(message: str, error_code: int | None = None, payload: str | None = None)[source]

Bases: BaseException

An exception raised for HTTP 401 Unauthorized errors.

Parameters:

BaseException – A custom exception class that inherits from python’s base exception and takes more parameters.

exception provenaclient.utils.exceptions.HTTPValidationException(message: str, error_code: int | None = None, payload: str | None = None)[source]

Bases: BaseException

An exception raised for HTTP 422 Unprocessable Entity errors.

Parameters:

BaseException – A custom exception class that inherits from python’s base exception and takes more parameters.

exception provenaclient.utils.exceptions.ServerException(message: str, error_code: int | None = None, payload: str | None = None)[source]

Bases: BaseException

An exception raised for HTTP 500+ Server Error responses.

Parameters:

BaseException – A custom exception class that inherits from python’s base exception and takes more parameters.

exception provenaclient.utils.exceptions.ValidationException(message: str, error_code: int | None = None, payload: str | None = None)[source]

Bases: BaseException

An exception that is raised for validation/parsing errors that occurs through the client library.

Parameters:

BaseException – A custom exception class that inherits from python’s base exception and takes more parameters.