IsGoneError reports whether err represents an HTTP 410 / "gone" response. It returns false when err is nil. The check is case-insensitive and only matches HTTP-style 410 patterns such as "HTTP 410" or "410 Gone", which avoids misclassifying unrelated errors like "connection has gone away".
(err error)
| 42 | // "HTTP 410" or "410 Gone", which avoids misclassifying unrelated errors like |
| 43 | // "connection has gone away". |
| 44 | func IsGoneError(err error) bool { |
| 45 | matched := containsHTTPStatusSubstring(err, "410", "gone") |
| 46 | if matched { |
| 47 | errorutilLog.Printf("Classified error as gone (410): %v", err) |
| 48 | } |
| 49 | return matched |
| 50 | } |
| 51 | |
| 52 | // containsErrorSubstring reports whether err contains any of the provided |
| 53 | // substrings after lowercasing the full error message for case-insensitive |