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

  • 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

Parameters

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

Raises

TypeError if response is not a Response or Dict

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

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