MCPcopy Index your code
hub / github.com/cockroachdb/errors / WithStack

Function WithStack

withstack/withstack.go:36–40  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

34// - in Sentry reports.
35// - when innermost stack capture, with `errors.GetOneLineSource()`.
36func 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

Callers 7

TestReportableStackTraceFunction · 0.92
makeErr2Function · 0.92
TestOneLineSourceFunction · 0.92
TestOneLineSourceInnerFunction · 0.92
TestReportFunction · 0.92
datadriven_test.goFile · 0.92
initFunction · 0.70

Calls 1

WithStackDepthFunction · 0.70

Tested by 5

TestReportableStackTraceFunction · 0.74
makeErr2Function · 0.74
TestOneLineSourceFunction · 0.74
TestOneLineSourceInnerFunction · 0.74
TestReportFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…