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 string)
| 23 | // by GetPGCode() below conditionally. |
| 24 | // The code is considered PII-free and is thus reportable. |
| 25 | func WithCandidateCode(err error, code string) error { |
| 26 | if err == nil { |
| 27 | return nil |
| 28 | } |
| 29 | |
| 30 | return &withCandidateCode{cause: err, code: code} |
| 31 | } |
| 32 | |
| 33 | // IsCandidateCode returns true iff the error (not its causes) |
| 34 | // has a candidate pg error code. |
no outgoing calls
no test coverage detected
searching dependent graphs…