Using `six.raise_from` wherever possible.
diff --git a/google/auth/jwt.py b/google/auth/jwt.py
index b1eb5fb..0253376 100644
--- a/google/auth/jwt.py
+++ b/google/auth/jwt.py
@@ -47,6 +47,7 @@
import json
import cachetools
+import six
from six.moves import urllib
from google.auth import _helpers
@@ -101,8 +102,9 @@
section_bytes = _helpers.padded_urlsafe_b64decode(encoded_section)
try:
return json.loads(section_bytes.decode('utf-8'))
- except ValueError:
- raise ValueError('Can\'t parse segment: {0}'.format(section_bytes))
+ except ValueError as caught_exc:
+ new_exc = ValueError('Can\'t parse segment: {0}'.format(section_bytes))
+ six.raise_from(new_exc, caught_exc)
def _unverified_decode(token):