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

Function WrapWithDepthf

errutil/utilities.go:143–161  ·  view source on GitHub ↗

WrapWithDepthf is like Wrapf except the depth to capture the stack trace is configurable. The the doc of `Wrapf()` for more details.

(depth int, err error, format string, args ...interface{})

Source from the content-addressed store, hash-verified

141// trace is configurable.
142// The the doc of `Wrapf()` for more details.
143func WrapWithDepthf(depth int, err error, format string, args ...interface{}) error {
144 if err == nil {
145 return nil
146 }
147 var errRefs []error
148 for _, a := range args {
149 if e, ok := a.(error); ok {
150 errRefs = append(errRefs, e)
151 }
152 }
153 if format != "" || len(args) > 0 {
154 err = WithMessagef(err, format, args...)
155 }
156 for _, e := range errRefs {
157 err = secondary.WithSecondaryError(err, e)
158 }
159 err = withstack.WithStackDepth(err, depth+1)
160 return err
161}
162
163// JoinWithDepth constructs a Join error with the provided list of
164// errors as arguments, and wraps it in a `WithStackDepth` to capture a

Callers 4

WrapfFunction · 0.92
WrapWithDepthfFunction · 0.92
WrapfFunction · 0.70

Calls 3

WithSecondaryErrorFunction · 0.92
WithStackDepthFunction · 0.92
WithMessagefFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…