Map all 5xx status codes to ServerError

Expands the HTTP status code mapping from 500-504 to 500-599 so that
uncommon 5xx codes (505, 507, etc.) are correctly classified as
retryable ServerError instead of falling through to message-based
heuristics. The existing 529 (Overloaded) handling is subsumed by
the broader range.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Bryan Helmkamp 2026-03-23 13:10:24 -04:00
parent 5d3a2d3cfa
commit 78c0910075
No known key found for this signature in database

View file

@ -232,7 +232,7 @@ pub fn error_from_status_code(
}
413 => ProviderErrorKind::ContextLength,
429 => ProviderErrorKind::RateLimit,
500..=504 | 529 => ProviderErrorKind::Server,
500..=599 => ProviderErrorKind::Server,
// For ambiguous status codes (400, 422, etc.), use message-based classification
_ => {
let lower_msg = detail.message.to_lowercase();