MCPcopy
hub / github.com/pkg/errors / Wrap

Function Wrap

errors.go:184–196  ·  view source on GitHub ↗

Wrap returns an error annotating err with a stack trace at the point Wrap is called, and the supplied message. If err is nil, Wrap returns nil.

(err error, message string)

Source from the content-addressed store, hash-verified

182// at the point Wrap is called, and the supplied message.
183// If err is nil, Wrap returns nil.
184func Wrap(err error, message string) error {
185 if err == nil {
186 return nil
187 }
188 err = &withMessage{
189 cause: err,
190 msg: message,
191 }
192 return &withStack{
193 err,
194 callers(),
195 }
196}
197
198// Wrapf returns an error annotating err with a stack trace
199// at the point Wrapf is called, and the format specifier.

Callers 9

TestFormatWrapFunction · 0.85
TestFormatWithMessageFunction · 0.85
TestFormatGenericFunction · 0.85
TestWrapNilFunction · 0.85
TestWrapFunction · 0.85
TestCauseFunction · 0.85
TestErrorEqualityFunction · 0.85
TestStackTraceFunction · 0.85
TestErrorChainCompatFunction · 0.85

Calls 1

callersFunction · 0.85

Tested by 9

TestFormatWrapFunction · 0.68
TestFormatWithMessageFunction · 0.68
TestFormatGenericFunction · 0.68
TestWrapNilFunction · 0.68
TestWrapFunction · 0.68
TestCauseFunction · 0.68
TestErrorEqualityFunction · 0.68
TestStackTraceFunction · 0.68
TestErrorChainCompatFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…