Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetOneLineSource ¶
GetOneLineSource extracts the file/line/function information of the topmost caller in the innermost recorded stack trace. The filename is simplified to remove the path prefix. This is used e.g. to populate the "source" field in PostgreSQL errors.
func WithStack ¶
WithStack annotates err with a stack trace at the point WithStack was called.
Detail is shown: - via `errors.GetSafeDetails()` - when formatting with `%+v`. - in Sentry reports. - when innermost stack capture, with `errors.GetOneLineSource()`.
func WithStackDepth ¶
WithStackDepth annotates err with a stack trace starting from the given call depth. The value zero identifies the caller of WithStackDepth itself. See the documentation of WithStack() for more details.
Types ¶
type Frame ¶
Frame is the type of a single call frame entry. This mirrors the type of the same name in github.com/pkg/errors.
type ReportableStackTrace ¶
type ReportableStackTrace = raven.Stacktrace
ReportableStackTrace aliases the type of the same name in the raven (Sentry) package. This is used by the 'report' error package.
func GetReportableStackTrace ¶
func GetReportableStackTrace(err error) *ReportableStackTrace
GetReportableStackTrace extracts a stack trace embedded in the given error in the format suitable for raven/Sentry reporting.
This supports:
- errors generated by github.com/pkg/errors (either generated locally or after transfer through the network),
- errors generated with WithStack() in this package,
- any other error that implements a StackTrace() method returning a StackTrace from github.com/pkg/errors.
Note: Sentry wants the oldest call frame first, so the entries are reversed in the result.
type StackTrace ¶
type StackTrace = pkgErr.StackTrace
StackTrace is the type of the data for a call stack. This mirrors the type of the same name in github.com/pkg/errors.