fix: show more meaningful error message for failed auth #879
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Previously when
snyk auth
failed for any reason we would always show theAuthFailed
error without checking what the status code was. This PR attempts to make the error message more useful to the user by distinguishing failed authorisation checks from other types of errors (network timeouts etc.)How should this be manually tested?
Run against a local registry, override the endpoint called by
verifyAPI
to return a 502 response (or any other).Any background context you want to provide?
There is already handling in place for 502 errors, but coercing all error types into a Not Authorised error resulted in it never being reached
What are the relevant tickets?
Zendesk