-
Notifications
You must be signed in to change notification settings - Fork 380
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
add http response to log #709
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ideally a usable error message should be returned to the caller, instead of the single ErrUnauthorizedForCredentials
constant.
OTOH that would be an ABI break…
dfffa35
to
cefef03
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM pending tests.
Thanks!
fix containers/podman#3884 Add http response message log to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
@@ -533,6 +533,8 @@ func (c *dockerClient) getBearerToken(ctx context.Context, challenge challenge, | |||
defer res.Body.Close() | |||
switch res.StatusCode { | |||
case http.StatusUnauthorized: | |||
err := client.HandleErrorResponse(res) | |||
logrus.Debugf("Server response when trying to obtain an access token: \n%q", err.Error()) | |||
return nil, ErrUnauthorizedForCredentials |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what does break API mean?
return nil, errors.Wrapf(err, "Server response when trying to obtain an access token")
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In current version Buildah and Podman can just look at the return code and compare it to ErrUnauthorizedForCredentials
If we wrap the error with the message, then podman and buildah will no longer get ErrUnauthorizedForCredentials back, they would have to take the error returned and change it to
if errors.Cause(err) == ErrUnauthorizedForCredentials
Any time the users of a library have to change their code, then you have broken ABI, if the callers do not have to change their code, then ABI remained the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, Thanks, PTAL #719
follow containers#709 return and wrap http response message to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
follow containers#709 return and wrap http response message to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
follow containers#709 return and wrap http response message to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
follow containers#709 return and wrap http response message to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
follow containers#709 return and wrap http response message to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
follow containers#709 return and wrap http response message to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
follow containers#709 return and wrap http response message to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
follow containers#709 return and wrap http response message to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
follow containers#709 return and wrap http response message to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
follow containers#709 return and wrap http response message to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
follow containers#709 return and wrap http response message to show server-side error message. Signed-off-by: Qi Wang <[email protected]>
fix containers/podman#3884
Add http response message log to show server-side error message.
Signed-off-by: Qi Wang [email protected]