Skip to content
This repository was archived by the owner on Feb 12, 2025. It is now read-only.

Commit 79a63e7

Browse files
authored
Return an error if resp and err are nil (#617)
This will allow retry logic to kick in and also avoid up-stream panics due to both the response and the error being nil.
1 parent 8c0b29a commit 79a63e7

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

autorest/adal/token.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -1030,9 +1030,11 @@ func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource
10301030
resp, err = spt.sender.Do(req)
10311031
}
10321032

1033+
// don't return a TokenRefreshError here; this will allow retry logic to apply
10331034
if err != nil {
1034-
// don't return a TokenRefreshError here; this will allow retry logic to apply
10351035
return fmt.Errorf("adal: Failed to execute the refresh request. Error = '%v'", err)
1036+
} else if resp == nil {
1037+
return fmt.Errorf("adal: received nil response and error")
10361038
}
10371039

10381040
logger.Instance.WriteResponse(resp, logger.Filter{Body: authBodyFilter})

0 commit comments

Comments
 (0)