File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -113,14 +113,14 @@ def encode(
113113 key = alg_obj .prepare_key (key )
114114 signature = alg_obj .sign (signing_input , key )
115115
116- except KeyError :
116+ except KeyError as e :
117117 if not has_crypto and algorithm in requires_cryptography :
118118 raise NotImplementedError (
119119 "Algorithm '%s' could not be found. Do you have cryptography "
120120 "installed?" % algorithm
121- )
121+ ) from e
122122 else :
123- raise NotImplementedError ("Algorithm not supported" )
123+ raise NotImplementedError ("Algorithm not supported" ) from e
124124
125125 segments .append (base64url_encode (signature ))
126126
@@ -236,8 +236,8 @@ def _verify_signature(
236236 if not alg_obj .verify (signing_input , key , signature ):
237237 raise InvalidSignatureError ("Signature verification failed" )
238238
239- except KeyError :
240- raise InvalidAlgorithmError ("Algorithm not supported" )
239+ except KeyError as e :
240+ raise InvalidAlgorithmError ("Algorithm not supported" ) from e
241241
242242 def _validate_headers (self , headers ):
243243 if "kid" in headers :
You can’t perform that action at this time.
0 commit comments