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

Function IsForbiddenError

pkg/errorutil/errors.go:31–37  ·  view source on GitHub ↗

IsForbiddenError reports whether err represents an HTTP 403 / "forbidden" response. It returns false when err is nil. The check is case-insensitive and only matches HTTP-style 403 patterns such as "HTTP 403" or "403 Forbidden", which avoids misclassifying unrelated errors like "forbidden character".

(err error)

Source from the content-addressed store, hash-verified

29// "HTTP 403" or "403 Forbidden", which avoids misclassifying unrelated errors
30// like "forbidden character".
31func IsForbiddenError(err error) bool {
32 matched := containsHTTPStatusSubstring(err, "403", "forbidden")
33 if matched {
34 errorutilLog.Printf("Classified error as forbidden (403): %v", err)
35 }
36 return matched
37}
38
39// IsGoneError reports whether err represents an HTTP 410 / "gone" response.
40// It returns false when err is nil.

Calls 2

PrintfMethod · 0.45