-
Notifications
You must be signed in to change notification settings - Fork 173
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
multierr.Errors is missing helper methods for error checking #302
Comments
Hey @adw1n, For the multierr-package in general: on first glance, it also looks like |
Just checked hashicorp/go-multierror again, and one thing struck out to me: there is no method to simply accumulate errors into the existing multi-Error like here where you can do errs := new(multierr.Errors)
errs.Collect(foo())
errs.Collect(bar()) the one from hashicorp and others require to overwrite the accumulator like this: var errs *multierr.Errors
errs = errs.Append(foo())
errs = errs.Append(bar()) Which version looks better is probably matter of taste, and the goka/multierr could use some more convenience functions. So I'm not sure what would be easier to do: extend goka/multierr with the needed functionality or replace it with some other library. |
Indeed, the reason to write multierr in first place was the accumulation of errors. |
it's been released to version v1.1.0-beta.1 |
I'll close this, as the underlying issue was basically fixed. Feel free to reopen or create a new issue if you need to. |
Goka processors return errors of type
multierr.Errors
. Users would like to be able to programmatically check the error types e.g. usingerrors.Is(err, context.Canceled)
to find out if the error is expected or not. Based off of the error type users will use different logging level - e.g.info
for expectedcontext.Canceled
errors anderror
for unexpected errors. Currently there is no way to retrieve any of the errors frommultierr.Errors.errs
.Is there really a need to have the
multierr
package ingoka
? Can't we use something like https://github.com/hashicorp/go-multierror that already has all the bells and whistles?The text was updated successfully, but these errors were encountered: