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

Function WithMessagef

errors.go:229–237  ·  view source on GitHub ↗

WithMessagef annotates err with the format specifier. If err is nil, WithMessagef returns nil.

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

Source from the content-addressed store, hash-verified

227// WithMessagef annotates err with the format specifier.
228// If err is nil, WithMessagef returns nil.
229func WithMessagef(err error, format string, args ...interface{}) error {
230 if err == nil {
231 return nil
232 }
233 return &withMessage{
234 cause: err,
235 msg: fmt.Sprintf(format, args...),
236 }
237}
238
239type withMessage struct {
240 cause error

Callers 5

TestWithMessagefNilFunction · 0.85
TestWithMessagefFunction · 0.85
TestIsFunction · 0.85
TestAsFunction · 0.85
TestUnwrapFunction · 0.85

Calls

no outgoing calls

Tested by 5

TestWithMessagefNilFunction · 0.68
TestWithMessagefFunction · 0.68
TestIsFunction · 0.68
TestAsFunction · 0.68
TestUnwrapFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…