The exceptions module

exception magento.exceptions.MagentoError(client, msg=None, response=None)[source]View on GitHub

Bases: Exception

Base exception class for error responses returned by the Magento API

Variables

DEFAULT_MSG – default exception message to use if a message isn’t provided

DEFAULT_MSG = 'An error occurred while processing the request.'
__init__(client, msg=None, response=None)[source]View on GitHub

Log and raise a MagentoError

Parameters
  • client (Client) – an initialized Client object

  • msg (Optional[str]) – optional exception message; prepended to the error message of the response (if provided).

  • response (Optional[Response]) – optional response to parse() an error message from

static parse(response)[source]View on GitHub

Parses the error message from the response, including message parameters when available

Parameters

response (Union[Response, dict]) – a bad response returned by the Magento API

Return type

str

exception magento.exceptions.AuthenticationError(client, msg=None, response=None)[source]View on GitHub

Bases: MagentoError

Exception class for errors when trying to authenticate() a Client

DEFAULT_MSG = 'Failed to authenticate credentials.'
__init__(client, msg=None, response=None)[source]View on GitHub

Log and raise a MagentoError

Parameters
  • client (Client) – an initialized Client object

  • msg (Optional[str]) – optional exception message; prepended to the error message of the response (if provided).

  • response (Optional[Response]) – optional response to parse() an error message from