failure
failure copied to clipboard
feature request: wrapping multiple errors
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
}))
}