MCPcopy Create free account
hub / github.com/auxten/postgresql-parser / IsError

Function IsError

pkg/testutils/error.go:21–34  ·  view source on GitHub ↗

IsError returns true if the error string matches the supplied regex. An empty regex is interpreted to mean that a nil error is expected.

(err error, re string)

Source from the content-addressed store, hash-verified

19// IsError returns true if the error string matches the supplied regex.
20// An empty regex is interpreted to mean that a nil error is expected.
21func IsError(err error, re string) bool {
22 if err == nil && re == "" {
23 return true
24 }
25 if err == nil || re == "" {
26 return false
27 }
28 errString := pgerror.FullError(err)
29 matched, merr := regexp.MatchString(re, errString)
30 if merr != nil {
31 return false
32 }
33 return matched
34}
35

Callers 2

TestParsePanicFunction · 0.92
TestParseOneFunction · 0.92

Calls 1

FullErrorFunction · 0.92

Tested by 2

TestParsePanicFunction · 0.74
TestParseOneFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…