RedactErrorf creates a new redactable error. Same signature as fmt.Errorf() for easy drop-in replacement.
(format string, args ...any)
| 26 | |
| 27 | // RedactErrorf creates a new redactable error. Same signature as fmt.Errorf() for easy drop-in replacement. |
| 28 | func RedactErrorf(format string, args ...any) *RedactableError { |
| 29 | // no-op call to enable golang.org/x/tools/go/analysis/passes/printf checking in go vet |
| 30 | if false { |
| 31 | _ = fmt.Errorf(format, args...) |
| 32 | } |
| 33 | return &RedactableError{ |
| 34 | fmt: format, |
| 35 | args: args, |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | // Error satisfies the error interface |
| 40 | func (re *RedactableError) Error() string { |