Hi,
Let's assume we have some nested errors:
function sthBuiltInWhichReturnsAPlainError() error {
return someBuiltErrorWithoutStack
}
func customFunctionWhichWrapsErrors() error {
err := sthBuiltInWhichReturnsAPlainError()
if err != nil {
return errors.Wrap(err, "something happened")
}
}
err := customFunctionWhichWrapsErrors()
errors.Cause(err) // <- Here I get the someBuiltErrorWithoutStack which has no stack
I would like to have the "last" error which has a stack. In this case it would be the one that is returned by customFunctionWhichWrapsErrors. But when I call errors.Cause I get the someBuiltErrorWithoutStack since this is the last one in the nesting.
Is this somehow possible without writing custom code?
Hi,
Let's assume we have some nested errors:
I would like to have the "last" error which has a stack. In this case it would be the one that is returned by customFunctionWhichWrapsErrors. But when I call errors.Cause I get the someBuiltErrorWithoutStack since this is the last one in the nesting.
Is this somehow possible without writing custom code?