Skip to content
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

feature request: wrapping multiple errors #49

Open
wreulicke opened this issue Sep 20, 2023 · 0 comments
Open

feature request: wrapping multiple errors #49

wreulicke opened this issue Sep 20, 2023 · 0 comments

Comments

@wreulicke
Copy link

wreulicke commented Sep 20, 2023

This is a feature request for wrapping multiple errors.

go 1.20 supports wrapping multiple errors.
https://tip.golang.org/doc/go1.20#errors

But, failure is a lack of support for wrapping multiple errors.

I want support for wrapping multiple errors.

But, I found you are working on v2.
Would you happen to have any plan for support for wrapping multiple errors on v2?

workaround and expected

I wrote current workaround and expected codes below.

err := doSomething(id)
if err != nil {
  // Currently, we have to combine `failure.Wrap and fmt.Errorf`
  return failure.Wrap(fmt.Errorf("foo bar :%w :%w", err, &MyError{
    ID: id
  }))

  // expected like this
  return failure.Wrap(err, failure.Message("foo bar"), failure.WithCause(&MyError{
    ID: id
  }))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant