You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
eris.ToJSON & eris.ToString doesn't capture wrapped error stacks after joining multiple errors with standard errors.Join. Even though the data is there.
This is because the eris.Unpack expects the the error to always be a linear chain of eris errors ending with one external error. The un-wrap loop breaks upon finding the first "external error". In the above case being described, the Error chain would be something like this: *eris.rootError -> `*errors.joinError{errs: []error{*eris.rootError, *eris.rootError}}.
Describe the solution you'd like
Update the eris.Unpack to expect multiple external errors in the chain of eris errors.
something like this:
// UnpackV2 returns a human-readable UnpackedError type for a given error.funcUnpackV2(errerror) UnpackedErrorV2 {
varupErrUnpackedErrorV2forerr!=nil {
switcherr:=err.(type) {
case*rootError:
upErr.ErrChain=append(upErr.ErrChain, ErrRoot{
Msg: err.msg,
Stack: err.stack.get(),
})
case*wrapError:
// prepend links in stack trace orderupErr.ErrChain=append(upErr.ErrChain, ErrLink{
Msg: err.msg,
Frame: err.frame.get(),
})
default:
upErr.ErrChain=append(upErr.ErrChain, ErrExternal(err))
}
err=Unwrap(err)
}
returnupErr
}
typeUnpackedErrorV2struct {
ErrChain []interface{
errType() stringformatJSON() map[string]interface{}
formatStr() string
}
}
Describe alternatives you've considered
I've considered following feature request, although the blast radius seems too big in that so I was trying to imagine a smaller and backward-compatible way of doing this.
Is your feature request related to a problem? Please describe.
eris.ToJSON
&eris.ToString
doesn't capture wrapped error stacks after joining multiple errors with standarderrors.Join
. Even though the data is there.This is because the
eris.Unpack
expects the the error to always be a linear chain of eris errors ending with one external error. The un-wrap loop breaks upon finding the first "external error". In the above case being described, the Error chain would be something like this:*eris.rootError
-> `*errors.joinError{errs: []error{*eris.rootError, *eris.rootError}}.Describe the solution you'd like
Update the
eris.Unpack
to expect multiple external errors in the chain of eris errors.something like this:
Describe alternatives you've considered
I've considered following feature request, although the blast radius seems too big in that so I was trying to imagine a smaller and backward-compatible way of doing this.
#101
Additional context
The text was updated successfully, but these errors were encountered: