core icon indicating copy to clipboard operation
core copied to clipboard

Obtaining stack trace from the error as []uintptr

Open mitar opened this issue 2 years ago • 1 comments

I made a spiritual successor of github.com/pkg/errors some time ago and in it I want to know if an error already contains a stack trace. The goal is that if a large codebase uses different packages for errors, they should work together and not hide existing recorded information, like a stack trace.

It seems this package does not expose the stack trace as []uintptr but only as a formatted string?

I would suggest that the following interface is implemented:

type stackTracer interface {
        StackTrace() []uintptr
}

Then, it is easy to obtain a stack trace, use it, format it. To me it looks like a simple type cast should be enough to do so?

mitar avatar Oct 09 '23 10:10 mitar

LGTM, thanks! Help wanted (:

bwplotka avatar Aug 29 '24 08:08 bwplotka