Add capacity error (#1947)

This commit is contained in:
pakrym-oai
2025-08-07 10:46:43 -07:00
committed by GitHub
parent a593b1c3ab
commit f23c3066c8
2 changed files with 9 additions and 0 deletions

View File

@@ -271,6 +271,10 @@ impl ModelClient {
}
if attempt > max_retries {
if status == StatusCode::INTERNAL_SERVER_ERROR {
return Err(CodexErr::InternalServerError);
}
return Err(CodexErr::RetryLimit(status));
}

View File

@@ -68,6 +68,11 @@ pub enum CodexErr {
#[error("Usage not included with the plan")]
UsageNotIncluded,
#[error(
"Were currently experiencing high demand, which may cause temporary errors. Were adding capacity in East and West Europe to restore normal service."
)]
InternalServerError,
/// Retry limit exceeded.
#[error("exceeded retry limit, last status: {0}")]
RetryLimit(StatusCode),