Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make AuthenticationFailedError consistent with other client errors #16736

Closed
chlowell opened this issue Jan 4, 2022 · 1 comment · Fixed by #16777
Closed

Make AuthenticationFailedError consistent with other client errors #16736

chlowell opened this issue Jan 4, 2022 · 1 comment · Fixed by #16777
Assignees
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved.

Comments

@chlowell
Copy link
Member

chlowell commented Jan 4, 2022

Credentials return AuthenticationFailedError when authentication fails. That type has a RawResponse() method which returns any response the credential received. Naively, it seems AuthenticationFailedError should instead wrap azcore.ResponseError, to enable consistent error handling. Otherwise the API compels applications to handle authentication failures differently than other errors:

err := client.Fail()
var res *http.Response
var authErr azidentity.AuthenticationFailedError
if errors.As(err, &authErr) {
	res = authErr.RawResponse()
}
var respErr azcore.ResponseError
if errors.As(err, &respErr) {
	res = respErr.RawResponse
}
@chlowell chlowell added Client This issue points to a problem in the data-plane of the library. Azure.Identity feature-request This issue requires a new behavior in the product in order be resolved. labels Jan 4, 2022
@chlowell chlowell added this to the [2022] February milestone Jan 4, 2022
@chlowell
Copy link
Member Author

chlowell commented Jan 6, 2022

Action items from offline discussion:

  • make AuthenticationFailedError a struct
    • with a RawResponse field
    • Error() should return a string like ResponseError.Error()

@github-actions github-actions bot locked and limited conversation to collaborators Apr 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Azure.Identity Client This issue points to a problem in the data-plane of the library. feature-request This issue requires a new behavior in the product in order be resolved.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants