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.

exceptions.py 986B

5 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. class PyJWTError(Exception):
  2. """
  3. Base class for all exceptions
  4. """
  5. pass
  6. class InvalidTokenError(PyJWTError):
  7. pass
  8. class DecodeError(InvalidTokenError):
  9. pass
  10. class InvalidSignatureError(DecodeError):
  11. pass
  12. class ExpiredSignatureError(InvalidTokenError):
  13. pass
  14. class InvalidAudienceError(InvalidTokenError):
  15. pass
  16. class InvalidIssuerError(InvalidTokenError):
  17. pass
  18. class InvalidIssuedAtError(InvalidTokenError):
  19. pass
  20. class ImmatureSignatureError(InvalidTokenError):
  21. pass
  22. class InvalidKeyError(PyJWTError):
  23. pass
  24. class InvalidAlgorithmError(InvalidTokenError):
  25. pass
  26. class MissingRequiredClaimError(InvalidTokenError):
  27. def __init__(self, claim):
  28. self.claim = claim
  29. def __str__(self):
  30. return 'Token is missing the "%s" claim' % self.claim
  31. # Compatibility aliases (deprecated)
  32. ExpiredSignature = ExpiredSignatureError
  33. InvalidAudience = InvalidAudienceError
  34. InvalidIssuer = InvalidIssuerError