MCPcopy Create free account
hub / github.com/juju/errors / Maskf

Function Maskf

functions.go:174–184  ·  view source on GitHub ↗

Maskf masks the given error with the given format string and arguments (like fmt.Sprintf), returning a new error that maintains the error stack, but hides the underlying error type. The error string still contains the full annotations. If you want to hide the annotations, call Wrap.

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

Source from the content-addressed store, hash-verified

172// hides the underlying error type. The error string still contains the full
173// annotations. If you want to hide the annotations, call Wrap.
174func Maskf(other error, format string, args ...interface{}) error {
175 if other == nil {
176 return nil
177 }
178 err := &Err{
179 message: fmt.Sprintf(format, args...),
180 previous: other,
181 }
182 err.SetLocation(1)
183 return err
184}
185
186// Mask hides the underlying error type, and records the location of the masking.
187func Mask(other error) error {

Callers 4

TestMaskfMethod · 0.92
TestCauseMethod · 0.92
TestErrorStackMethod · 0.92
TestErrorStringMethod · 0.92

Calls 1

SetLocationMethod · 0.95

Tested by 4

TestMaskfMethod · 0.74
TestCauseMethod · 0.74
TestErrorStackMethod · 0.74
TestErrorStringMethod · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…