aboutsummaryrefslogtreecommitdiff
path: root/google/auth/_default.py
diff options
context:
space:
mode:
Diffstat (limited to 'google/auth/_default.py')
-rw-r--r--google/auth/_default.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/google/auth/_default.py b/google/auth/_default.py
index 8b0573b..4ae7c8c 100644
--- a/google/auth/_default.py
+++ b/google/auth/_default.py
@@ -23,6 +23,8 @@ import logging
import os
import warnings
+import six
+
from google.auth import environment_vars
from google.auth import exceptions
import google.auth.transport._http_client
@@ -116,7 +118,7 @@ def load_credentials_from_file(
new_exc = exceptions.DefaultCredentialsError(
"File {} is not a valid json file.".format(filename), caught_exc
)
- raise new_exc from caught_exc
+ six.raise_from(new_exc, caught_exc)
# The type key should indicate that the file is either a service account
# credentials file or an authorized user credentials file.
@@ -132,7 +134,7 @@ def load_credentials_from_file(
except ValueError as caught_exc:
msg = "Failed to load authorized user credentials from {}".format(filename)
new_exc = exceptions.DefaultCredentialsError(msg, caught_exc)
- raise new_exc from caught_exc
+ six.raise_from(new_exc, caught_exc)
if quota_project_id:
credentials = credentials.with_quota_project(quota_project_id)
if not credentials.quota_project_id:
@@ -149,7 +151,7 @@ def load_credentials_from_file(
except ValueError as caught_exc:
msg = "Failed to load service account credentials from {}".format(filename)
new_exc = exceptions.DefaultCredentialsError(msg, caught_exc)
- raise new_exc from caught_exc
+ six.raise_from(new_exc, caught_exc)
if quota_project_id:
credentials = credentials.with_quota_project(quota_project_id)
return credentials, info.get("project_id")