Python SDK for DERO Merchant REST API
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
780B

  1. class APIError(Exception):
  2. """Exception that represents the error object returned by the API.
  3. Attributes:
  4. code: Integer of the error code returned by the API
  5. message: String of the error message returned by the API
  6. """
  7. def __init__(self, code: int, message: str):
  8. """Inits APIError with code and message
  9. Args:
  10. code: Integer of the error code returned by the API
  11. message: String of the error message returned by the API
  12. """
  13. self.code = code
  14. self.message = message
  15. def __str__(self):
  16. """Describes the exception.
  17. Returns:
  18. A string with the description of the error.
  19. """
  20. return f'API Error {self.code}: {self.message}'