MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / is_retryable

Method is_retryable

crates/opencode-provider/src/provider.rs:84–108  ·  view source on GitHub ↗
(&self)

Source from the content-addressed store, hash-verified

82
83impl crate::retry::IsRetryable for ProviderError {
84 fn is_retryable(&self) -> Option<String> {
85 match self {
86 ProviderError::RateLimit => Some("Rate limited".to_string()),
87 ProviderError::Timeout => Some("Request timed out".to_string()),
88 ProviderError::NetworkError(msg) => Some(format!("Network error: {msg}")),
89 ProviderError::ApiErrorWithStatus {
90 status_code,
91 message,
92 } => {
93 if matches!(status_code, 429 | 500 | 502 | 503 | 504) {
94 Some(format!("API error {status_code}: {message}"))
95 } else {
96 None
97 }
98 }
99 ProviderError::ApiError(_)
100 | ProviderError::AuthError(_)
101 | ProviderError::ModelNotFound(_)
102 | ProviderError::InvalidRequest(_)
103 | ProviderError::StreamError(_)
104 | ProviderError::ProviderNotFound(_)
105 | ProviderError::ConfigError(_)
106 | ProviderError::ContextOverflow(_) => None,
107 }
108 }
109}
110
111static OVERFLOW_PATTERNS: Lazy<Vec<Regex>> = Lazy::new(|| {

Callers 2

with_retryFunction · 0.80
with_retry_and_hookFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected