-
Notifications
You must be signed in to change notification settings - Fork 93
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
Replace use of multierror libraries with now standardised errors.Join #3744
Conversation
Important Auto Review SkippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
errors.Join preserves the tree of errors by producing structures with Unwrap() []error calls available whereas multierr{or} only produces a linear chain of errors using Unwrap() error calls. This is a largely mechanical change using find/replace.
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.
I just want to point out that the output is different from both libraries as shown below:
Using errors.Join with two errors
name cannot be empty
email is invalid
Using multierror
2 errors occurred:
* name cannot be empty
* email is invalid
Yes, it's true. In the next commits I'll introduce a better mechanism for printing errors in the CLI, which will look more like the latter example. So if you want me to close this PR and merge it in with that work, I can do that. |
errors.Join
preserves the tree of errors by producing structures withUnwrap() []error
calls available whereas multierr{or} only produces a linear chain of errors usingUnwrap() error
calls. This is a largely mechanical change using find/replace.This is necessary for subsequent work to returned properly structured errors from the API and show them in the CLI.