MCPcopy Create free account
hub / github.com/dolthub/doltgresql / WithCandidateCode

Function WithCandidateCode

postgres/parser/pgerror/pgcode.go:39–45  ·  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

37// by GetPGCode() below conditionally.
38// The code is considered PII-free and is thus reportable.
39func WithCandidateCode(err error, code pgcode.Code) error {
40 if err == nil {
41 return nil
42 }
43
44 return &withCandidateCode{cause: err, code: code.String()}
45}
46
47// HasCandidateCode returns tue iff the error or one of its causes
48// has a candidate pg error code.

Callers 15

ParseFunction · 0.92
FromEncodingPartsFunction · 0.92
GetBitAtIndexMethod · 0.92
SetBitAtIndexMethod · 0.92
pgdate.goFile · 0.92
ToTimeMethod · 0.92
AddDaysMethod · 0.92
SubDaysMethod · 0.92
inputErrorfFunction · 0.92
outOfRangeErrorFunction · 0.92
parseErrorFunction · 0.92
helpWithFunction · 0.92

Calls 1

StringMethod · 0.65

Tested by

no test coverage detected