This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Description
Right now, if your error is the following:
import "github.com/pkg/errors"
...
return errors.WithStack(err)
...
it will not use that stacktrace. The reason is in client.go:
|
cause := pkgErrors.Cause(err) |
|
|
|
packet := NewPacketWithExtra(err.Error(), extra, append(append(interfaces, client.context.interfaces()...), NewException(cause, GetOrNewStacktrace(cause, 1, 3, client.includePaths)))...) |
cause gets used for the Stacktrace generation. However, Cause is called on the result of errors.WithStack, which simply removes that layer, so we don't have a trace anymore.
Is there a reason why Cause is used here? Maybe instead of always taking the Cause, check if the current err has a Stacktrace and cause has not, and use the stack of err?