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

Function Errorf

functions.go:31–35  ·  view source on GitHub ↗

Errorf creates a new annotated error and records the location that the error is created. This should be a drop in replacement for fmt.Errorf. For example: return errors.Errorf("validation failed: %s", message)

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

Source from the content-addressed store, hash-verified

29// return errors.Errorf("validation failed: %s", message)
30//
31func Errorf(format string, args ...interface{}) error {
32 err := &Err{message: fmt.Sprintf(format, args...)}
33 err.SetLocation(1)
34 return err
35}
36
37// getLocation records the package path-qualified function name of the error at
38// callDepth stack frames above the call.

Callers 3

TestErrorfMethod · 0.92
TestErrorStackMethod · 0.92
TestErrorStringMethod · 0.92

Calls 1

SetLocationMethod · 0.95

Tested by 3

TestErrorfMethod · 0.74
TestErrorStackMethod · 0.74
TestErrorStringMethod · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…