WithCandidateCode decorates the error with a candidate postgres error code. It is called "candidate" because the code is only used by GetPGCode() below conditionally. The code is considered PII-free and is thus reportable.
(err error, code pgcode.Code)
| 17 | // by GetPGCode() below conditionally. |
| 18 | // The code is considered PII-free and is thus reportable. |
| 19 | func WithCandidateCode(err error, code pgcode.Code) error { |
| 20 | if err == nil { |
| 21 | return nil |
| 22 | } |
| 23 | return &withCandidateCode{cause: err, code: code.String()} |
| 24 | } |
| 25 | |
| 26 | // HasCandidateCode returns tue iff the error or one of its causes |
| 27 | // has a candidate pg error code. |
no test coverage detected
searching dependent graphs…