This file mirrors the WithStack functionality from github.com/pkg/errors. We would prefer to reuse the withStack struct from that package directly (the library recognizes it well) unfortunately github.com/pkg/errors does not enable client code to customize the depth at which the stack trace is captu
(err error)
| 34 | // - in Sentry reports. |
| 35 | // - when innermost stack capture, with `errors.GetOneLineSource()`. |
| 36 | func WithStack(err error) error { |
| 37 | // Skip the frame of WithStack itself, this mirrors the behavior |
| 38 | // of WithStack() in github.com/pkg/errors. |
| 39 | return WithStackDepth(err, 1) |
| 40 | } |
| 41 | |
| 42 | // WithStackDepth annotates err with a stack trace starting from the |
| 43 | // given call depth. The value zero identifies the caller |
searching dependent graphs…