SafeFormatter is implemented by error leaf or wrapper types that want to separate safe and non-safe information when printed out. When multiple errors are chained (e.g. via errors.Wrap), intermediate layers in the error that do not implement SafeError are considered “unsafe”
| 54 | // layers in the error that do not implement SafeError are considered |
| 55 | // “unsafe” |
| 56 | type SafeFormatter interface { |
| 57 | // SafeFormatError prints the receiver's first error. |
| 58 | // |
| 59 | // The provided Printer behaves like a redact.SafePrinter its |
| 60 | // Print() and Printf() methods conditionally add redaction markers |
| 61 | // around unsafe bits. |
| 62 | // |
| 63 | // The return value of SafeFormatError() decides what happens in the |
| 64 | // case the method is used to produce a "short" message, eg. when it |
| 65 | // is used to implement Error(): |
| 66 | // |
| 67 | // - if it returns nil, then the short message |
| 68 | // contains no more than that produced for this error, |
| 69 | // even if the error has a further causal chain. |
| 70 | // |
| 71 | // - if it returns non-nil, then the short message |
| 72 | // contains the value printed by this error, |
| 73 | // followed by that of its causal chain. |
| 74 | // (e.g. thiserror: itscause: furthercause) |
| 75 | // |
| 76 | // Note that all the causal chain is reported in verbose reports in |
| 77 | // any case. |
| 78 | SafeFormatError(p Printer) (next error) |
| 79 | } |
| 80 | |
| 81 | // A Printer formats error messages. |
| 82 | // |
no outgoing calls
no test coverage detected
searching dependent graphs…