Repository navigation
Improve BitBucket unauthorized error message - #813
Merged
Merged
Conversation
On 401 unauthorized responses, BitBucket does not always return a JSON
body. That was causing the error handling code that's being changed here
to throw an error itself, which led to errors like:
```
error: invalid json response body at [url] reason: Unexpected end of JSON input {"type":"invalid-json"}
```
Which was a bit confusing to me. This commit changes the error handling
code to return a generic error message instead. So with an incorrect
BitBucket token, CML now prints:
```
error: Unauthorized
```
Which should be more helpful to the user.
0x2b3bfa0
reviewed
Nov 17, 2021
7 of 15 tasks
Co-authored-by: Helio Machado <[email protected]>
Contributor
Author
|
GitLab CI failed with an error from Terraform. I don't have enough context to easily see what's happening there, but it looks like a timeout that's unrelated to the changes here. |
Member
This happens because the spot instance request didn't get fulfilled before the 10 minute deadline. The error is because we lack enough permissions to remove the request, but it would have failed anyway. |
Contributor
|
Thanks for the contribution ❤️ @duijf now we feel obligated to break Viewer... somehow 😁 |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Was playing around with CML for some integration work with Studio when I encountered this papercut.
On 401 unauthorized responses, the BitBucket API does not always return a JSON body. That was causing the error handling code that's being changed here to throw an error itself, which led to errors like:
Which was a bit confusing to me. This commit changes the error handling code to return a generic error message instead. So with an incorrect BitBucket token, CML now prints:
Which should be a little more helpful to the user.
NB: My JS is not the best ever, so if something looks weird / unidiomatic, it probably is. Please let me know if you'd like to see any changes :)