A Formatter formats error messages. NB: Consider implementing SafeFormatter instead. This will ensure that error displays can distinguish bits that are PII-safe.
| 26 | // NB: Consider implementing SafeFormatter instead. This will ensure |
| 27 | // that error displays can distinguish bits that are PII-safe. |
| 28 | type Formatter interface { |
| 29 | error |
| 30 | |
| 31 | // FormatError prints the receiver's first error. |
| 32 | // The return value decides what happens in the case |
| 33 | // FormatError() is used to produce a "short" message, |
| 34 | // eg. when it is used to implement Error(): |
| 35 | // |
| 36 | // - if it returns nil, then the short message |
| 37 | // contains no more than that produced for this error, |
| 38 | // even if the error has a further causal chain. |
| 39 | // |
| 40 | // - if it returns non-nil, then the short message |
| 41 | // contains the value printed by this error, |
| 42 | // followed by that of its causal chain. |
| 43 | // (e.g. thiserror: itscause: furthercause) |
| 44 | // |
| 45 | // Note that all the causal chain is reported in verbose reports in |
| 46 | // any case. |
| 47 | FormatError(p Printer) (next error) |
| 48 | } |
| 49 | |
| 50 | // SafeFormatter is implemented by error leaf or wrapper types that want |
| 51 | // to separate safe and non-safe information when printed out. |
no outgoing calls
no test coverage detected
searching dependent graphs…