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{})
| 29 | // return errors.Errorf("validation failed: %s", message) |
| 30 | // |
| 31 | func 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. |
searching dependent graphs…