Add error message to handle case of empty string or missing file for GOOGLE_APPLICATION_CREDENTIALS (#188)
Fixes #161
diff --git a/google/auth/_default.py b/google/auth/_default.py
index 1e91368..7dac642 100644
--- a/google/auth/_default.py
+++ b/google/auth/_default.py
@@ -58,8 +58,12 @@
Raises:
google.auth.exceptions.DefaultCredentialsError: if the file is in the
- wrong format.
+ wrong format or is missing.
"""
+ if not os.path.exists(filename):
+ raise exceptions.DefaultCredentialsError(
+ 'File {} was not found.'.format(filename))
+
with io.open(filename, 'r') as file_obj:
try:
info = json.load(file_obj)