Skip to content

Commit e72b1dc

Browse files
committed
google/externalaccount: return error messages from file cred opening
subjectToken function now return error messages when failing to open file credentials. This will allow distinguishing between file not found and other errors.
1 parent 3e64809 commit e72b1dc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

google/externalaccount/filecredsource.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func (cs fileCredentialSource) credentialSourceType() string {
2626
func (cs fileCredentialSource) subjectToken() (string, error) {
2727
tokenFile, err := os.Open(cs.File)
2828
if err != nil {
29-
return "", fmt.Errorf("oauth2/google/externalaccount: failed to open credential file %q", cs.File)
29+
return "", fmt.Errorf("oauth2/google/externalaccount: failed to open credential file %q due to %v", cs.File, err)
3030
}
3131
defer tokenFile.Close()
3232
tokenBytes, err := ioutil.ReadAll(io.LimitReader(tokenFile, 1<<20))

0 commit comments

Comments
 (0)