MCPcopy Create free account
hub / github.com/github/gh-aw / containsErrorSubstring

Function containsErrorSubstring

pkg/errorutil/errors.go:55–66  ·  view source on GitHub ↗

containsErrorSubstring reports whether err contains any of the provided substrings after lowercasing the full error message for case-insensitive matching.

(err error, substrings ...string)

Source from the content-addressed store, hash-verified

53// substrings after lowercasing the full error message for case-insensitive
54// matching.
55func containsErrorSubstring(err error, substrings ...string) bool {
56 if err == nil {
57 return false
58 }
59 msg := strings.ToLower(err.Error())
60 for _, substring := range substrings {
61 if strings.Contains(msg, substring) {
62 return true
63 }
64 }
65 return false
66}
67
68// containsHTTPStatusSubstring reports whether err contains a recognized
69// HTTP-style status pattern for the provided status code and keyword.

Callers 2

IsNotFoundErrorFunction · 0.85

Calls 2

ToLowerMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected