From 914c26b4c65865deda5240b3d3eb347ee8e6d799 Mon Sep 17 00:00:00 2001 From: Brandon Thomas Date: Wed, 21 May 2025 11:04:32 -0400 Subject: [PATCH] classify gateway timeout --- .../src/utils/classify_general_http_error.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/lib/api_clients/openai_sora_client/src/utils/classify_general_http_error.rs b/crates/lib/api_clients/openai_sora_client/src/utils/classify_general_http_error.rs index 69912acd43..a2241f694c 100644 --- a/crates/lib/api_clients/openai_sora_client/src/utils/classify_general_http_error.rs +++ b/crates/lib/api_clients/openai_sora_client/src/utils/classify_general_http_error.rs @@ -57,7 +57,13 @@ Message: { 502 => { return SoraError::BadGateway(message); } + 504 => { + if message.contains("cloudflare") || message.contains("Cloudflare") { + return SoraError::CloudFlareTimeout(message); + } + } 524 => { + // NB: 524 is a cloudflare specific gateway timeout error with slightly different semantics than 504. if message.contains("cloudflare") || message.contains("Cloudflare") { return SoraError::CloudFlareTimeout(message); }