diff options
| author | Mark Adams <mark@markadams.me> | 2017-03-14 19:04:12 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-03-14 19:04:12 -0500 |
| commit | 877b2575e3ac9be1cfb7501525bac395384f3c40 (patch) | |
| tree | dcfdd94edb8d89b2222949ead86694a9e1720be8 /jwt/exceptions.py | |
| parent | 1710c1524c69c39dfece7a24b87179be5eeff217 (diff) | |
| parent | d04339de54fca44c09ae9105627ab4ae7e0abdb1 (diff) | |
| download | pyjwt-fix-ec-ssh-pub-key.tar.gz | |
Merge pull request #245 from jpadilla/fix-key-errorsfix-ec-ssh-pub-key
Refactor error handling in Algorithm.prepare_key() methods
Diffstat (limited to 'jwt/exceptions.py')
| -rw-r--r-- | jwt/exceptions.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/jwt/exceptions.py b/jwt/exceptions.py index 31177a0..48a6e16 100644 --- a/jwt/exceptions.py +++ b/jwt/exceptions.py @@ -26,10 +26,18 @@ class ImmatureSignatureError(InvalidTokenError): pass -class InvalidKeyError(Exception): +class InvalidKeyError(ValueError): pass +class InvalidAsymmetricKeyError(InvalidKeyError): + message = 'Invalid key: Keys must be in PEM or RFC 4253 format.' + + +class InvalidJwkError(InvalidKeyError): + message = 'Invalid key: Keys must be in JWK format.' + + class InvalidAlgorithmError(InvalidTokenError): pass |
