Exception Reference

NamecomError is the base exception class, all its subclass has fixed status_code and message.

make_exception() is used by api to throw errors, it accepts a response, parse the status_code and message and map the error to a specific exception class.

namecom.exceptions.make_exception(resp)

Parse response content and return a NamecomError instance.

exception namecom.exceptions.NamecomError(status_code, headers, message, details)

Base Exception class for namecom api.

Parameters:
  • status_code (int) – http response status code
  • headers (MutableMapping) – http response headers from requests.Response
  • message (str) – a general error message
  • details (str) – an optional “details” key which contains a string with additional information about the error
exception namecom.exceptions.PermissionDeniedError(status_code, headers, message, details)

Fixed params: status_code -> 403, message -> Permission Denied

Parameters:
  • status_code (int) – http response status code
  • headers (MutableMapping) – http response headers from requests.Response
  • message (str) – a general error message
  • details (str) – an optional “details” key which contains a string with additional information about the error
exception namecom.exceptions.InvalidArgumentError(status_code, headers, message, details)

Fixed params: status_code -> 400, message -> Invalid Argument

Parameters:
  • status_code (int) – http response status code
  • headers (MutableMapping) – http response headers from requests.Response
  • message (str) – a general error message
  • details (str) – an optional “details” key which contains a string with additional information about the error
exception namecom.exceptions.NotFoundError(status_code, headers, message, details)

Fixed params: status_code -> 404, message -> Not Found

Parameters:
  • status_code (int) – http response status code
  • headers (MutableMapping) – http response headers from requests.Response
  • message (str) – a general error message
  • details (str) – an optional “details” key which contains a string with additional information about the error
exception namecom.exceptions.ServerError(status_code, headers, message, details)

Fixed params: status_code -> 500, message -> Internal Error

Parameters:
  • status_code (int) – http response status code
  • headers (MutableMapping) – http response headers from requests.Response
  • message (str) – a general error message
  • details (str) – an optional “details” key which contains a string with additional information about the error