Conversation
Brian Strauch (brianstrauch)
previously requested changes
Sep 22, 2022
internal/pkg/errors/catcher.go
Outdated
Comment on lines
+175
to
+177
| return Wrap(err, strings.TrimFunc(resBody.Error.Message, func(c rune) bool { | ||
| return c == rune('.') || c == rune('\n') | ||
| })) |
There was a problem hiding this comment.
It blows my mind why you'd ever end an error with a newline... Anyways, let's do this in two separate steps instead? 1. Trim the error message, 2. Wrap the error
There was a problem hiding this comment.
By the way, can we use strings.TrimRight() instead of strings.TrimFunc()? If strings.TrimRight() doesn't like newlines, maybe we could use strings.TrimSpace() instead? (The runes are confusing, and needing a trim function seems like overkill)
Contributor
Author
There was a problem hiding this comment.
some errors only have . or \n and some have both. using 2 nested trim looks kinda not clean to me?
merging for today's release
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.
Checklist
What
connect team caught that 400 error message of pausing a connect is not caught and only printing out the error code. In this pr I made changes to parse and print all v2 api call response error messages.
Notice that there are 3 different structure of responses of v2 api's (something teams should work on to unify):
Errors with a list of error details, error message, error with a string of code and message. So we need 3 structs to unmarshall them all.
References
Test & Review