errors module#

exception errors.ACCOUNT_ALREADY_LINKED(details: dict, *args, **kwargs)[source]#

Bases: WP_Error

Represents an error where the account is already linked.

Args:

details (dict): The details of the exception.

exception errors.ACCOUNT_NOT_LINKED(details: dict, *args, **kwargs)[source]#

Bases: WP_Error

Represents an error where the account was not linked.

Args:

details (dict): The details of the exception.

errors.ALL_EXCEPTIONS = {'ACCOUNT_ALREADY_LINKED': <class 'errors.ACCOUNT_ALREADY_LINKED'>, 'ACCOUNT_NOT_LINKED': <class 'errors.ACCOUNT_NOT_LINKED'>, 'INCORRECT_PRODUCT_ID_TYPE': <class 'errors.INCORRECT_PRODUCT_ID_TYPE'>, 'INSUFFICIENT_PERMISSIONS': <class 'errors.INSUFFICIENT_PERMISSIONS'>, 'INVALID_DISCORD_ID_SIZE': <class 'errors.INVALID_DISCORD_ID_SIZE'>, 'INVALID_DISCORD_ID_TYPE': <class 'errors.INVALID_DISCORD_ID_TYPE'>, 'INVALID_TOKEN_SIZE': <class 'errors.INVALID_TOKEN_SIZE'>, 'LINK_TOKEN_NOT_FOUND': <class 'errors.LINK_TOKEN_NOT_FOUND'>, 'NOT_IMPERSONATING': <class 'errors.NOT_IMPERSONATING'>, 'PRODUCT_NOT_FOUND': <class 'errors.PRODUCT_NOT_FOUND'>, 'PRODUCT_NOT_IN_CART': <class 'errors.PRODUCT_NOT_IN_CART'>, 'UNKNOWN_ERROR': <class 'errors.UNKNOWN_ERROR'>}#

Holds all the exceptions of the API.

This variable is a dictionary where the following is True:

  • key => Name of exception

  • value => Reference to the exception’s class

exception errors.INCORRECT_PRODUCT_ID_TYPE(details: dict, *args, **kwargs)[source]#

Bases: WP_Error

exception errors.INSUFFICIENT_PERMISSIONS(details: dict, *args, **kwargs)[source]#

Bases: WP_Error

Represents an error where the user has insufficient permissions.

Args:

details (dict): The details of the exception.

exception errors.INVALID_DISCORD_ID_SIZE(details: dict, *args, **kwargs)[source]#

Bases: WP_Error

Represents an error where the discord ID length was incorrect.

Args:

details (dict): The details of the exception.

exception errors.INVALID_DISCORD_ID_TYPE(details: dict, *args, **kwargs)[source]#

Bases: WP_Error

Represents an error where the discord ID type was incorrect.

Args:

details (dict): The details of the exception.

exception errors.INVALID_TOKEN_SIZE(details: dict, *args, **kwargs)[source]#

Bases: WP_Error

Represents an error where the token size was not correct.

Args:

details (dict): The details of the exception.

Bases: WP_Error

Represents an error where the token was not found.

Args:

details (dict): The details of the exception.

exception errors.NOT_IMPERSONATING(details: dict, *args, **kwargs)[source]#

Bases: WP_Error

Represents an error where the user is not impersonating anyone.

NOTE: This exception should not be thrown, but it’s here since it exists.

Args:

details (dict): The details of the exception.

exception errors.PRODUCT_NOT_FOUND(details: dict, *args, **kwargs)[source]#

Bases: WP_Error

exception errors.PRODUCT_NOT_IN_CART(details: dict, *args, **kwargs)[source]#

Bases: WP_Error

exception errors.UNKNOWN_ERROR(details: dict, *args, **kwargs)[source]#

Bases: WP_Error

Represents an unknown error.

Args:

details (dict): The details of the exception.

exception errors.WP_Error(details: dict | None = None, *args, default_code='UNKNOWN_ERROR', default_message='An unknown error occurred!', **kwargs)[source]#

Bases: Exception

Represents an API (wordpress) error.

Args:

details (Optional[dict]): The details to store to the object. default_code (Optional[str]): The default error code of the exception. Defaults to “UNKNOWN_ERROR”. default_message (str, optional): The default error message of the exception. Defaults to “An unknown error occurred!”.

static sanitize_kwargs(kwargs: dict)[source]#

Remove some keyword-only parameters from the kwargs dictionary. Easy cleaning for child exception parameters.

Args:

kwargs (dict): The dictionary to sanitize.

errors.get_exception(details: dict, *args, **kwargs)[source]#