IsNotFoundError reports whether err represents an HTTP 404 / "not found" response. It returns false when err is nil. The check is case-insensitive and matches both the numeric literal "404" and the phrase "not found", which covers all known forms returned by the GitHub API, the gh CLI, and the go-gh
(err error)
| 16 | // the phrase "not found", which covers all known forms returned by the GitHub API, |
| 17 | // the gh CLI, and the go-gh library. |
| 18 | func IsNotFoundError(err error) bool { |
| 19 | matched := containsErrorSubstring(err, "404", "not found") |
| 20 | if matched { |
| 21 | errorutilLog.Printf("Classified error as not-found (404): %v", err) |
| 22 | } |
| 23 | return matched |
| 24 | } |
| 25 | |
| 26 | // IsForbiddenError reports whether err represents an HTTP 403 / "forbidden" response. |
| 27 | // It returns false when err is nil. |