MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / WithCandidateCode

Function WithCandidateCode

pkg/sql/pgwire/pgerror/pgcode.go:19–24  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

17// by GetPGCode() below conditionally.
18// The code is considered PII-free and is thus reportable.
19func 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.

Callers 15

helpWithFunction · 0.92
RunShowSyntaxFunction · 0.92
parse.goFile · 0.92
newDecimalFunction · 0.92
setErrMethod · 0.92
setErrNoDetailsMethod · 0.92
ErrorMethod · 0.92
PopulateErrorDetailsFunction · 0.92
SetHelpMethod · 0.92
setErrMethod · 0.92
setErrNoDetailsMethod · 0.92

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…