Skip to content

Improve error message in plugin push command#2145

Merged
mfridman merged 2 commits intomainfrom
plugin-push-auth-check
May 31, 2023
Merged

Improve error message in plugin push command#2145
mfridman merged 2 commits intomainfrom
plugin-push-auth-check

Conversation

@mfridman
Copy link
Member

Small improvement to the error string we surface to unauthenticated users trying to interact with the OCI registry.

Instead of:

Failure: GET https://{remote}/v2/{name}/tags/list?n=1000: unexpected status code 401 Unauthorized

It's now:

Failure: you are not authenticated. For details, visit https://buf.build/docs/bsr/authentication

structuredErr := new(transport.Error)
if errors.As(err, &structuredErr) {
if structuredErr.StatusCode == http.StatusUnauthorized {
return "", errors.New("you are not authenticated. For details, visit https://buf.build/docs/bsr/authentication")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll probably want to update all the https://docs.buf.build references in the future, @rakuista is this on your radar. Do we care?

@mfridman mfridman merged commit bc75f14 into main May 31, 2023
@mfridman mfridman deleted the plugin-push-auth-check branch May 31, 2023 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants