/pyfcm/errors.py

https://github.com/olucurious/PyFCM · Python · 48 lines · 13 code · 9 blank · 26 comment · 0 complexity · aa3a3f64d7d8ed53409fe2f417a8af18 MD5 · raw file

  1. class FCMError(Exception):
  2. """
  3. PyFCM Error
  4. """
  5. pass
  6. class AuthenticationError(FCMError):
  7. """
  8. API key not found or there was an error authenticating the sender
  9. """
  10. pass
  11. class FCMNotRegisteredError(FCMError):
  12. """
  13. push token is not registered
  14. https://firebase.google.com/docs/reference/fcm/rest/v1/ErrorCode
  15. """
  16. pass
  17. class FCMServerError(FCMError):
  18. """
  19. Internal server error or timeout error on Firebase cloud messaging server
  20. """
  21. pass
  22. class InvalidDataError(FCMError):
  23. """
  24. Invalid input
  25. """
  26. pass
  27. class InternalPackageError(FCMError):
  28. """
  29. JSON parsing error, please create a new github issue describing what you're doing
  30. """
  31. pass
  32. class RetryAfterException(Exception):
  33. """
  34. Retry-After must be handled by external logic.
  35. """
  36. def __init__(self, delay):
  37. self.delay = delay