pub enum Error {
Validation(ErrorDetails),
AccessDenied(ErrorDetails),
ServiceQuotaExceeded(ErrorDetails),
ResourceNotFound(ErrorDetails),
Throttling(ErrorDetails),
ModelTimeout(ErrorDetails),
ModelError(ErrorDetails),
ModelStreamError(ErrorDetails),
ServiceUnavailable(ErrorDetails),
InternalServer(ErrorDetails),
MissingApiKey,
Sdk(String),
}Expand description
The SDK error type — all variants mirror the spec §4 exception taxonomy.
Variants§
Validation(ErrorDetails)
400 / invalid_request_error / VALIDATION_ERROR
AccessDenied(ErrorDetails)
401/403 / authentication_error / AUTHORIZATION_ERROR / MODEL_NOT_ALLOWED
ServiceQuotaExceeded(ErrorDetails)
402 / usage_cap_exceeded / BUDGET_EXCEEDED
ResourceNotFound(ErrorDetails)
404 / MODEL_NOT_FOUND
Throttling(ErrorDetails)
429 (retryable) / rate_limit_exceeded / RATE_LIMIT_EXCEEDED
ModelTimeout(ErrorDetails)
408 / TIMEOUT_ERROR
ModelError(ErrorDetails)
5xx model-side error
ModelStreamError(ErrorDetails)
Stream-specific error (subtype of ModelError)
503/502/504 / ServiceUnavailable
InternalServer(ErrorDetails)
500 / InternalServerException
MissingApiKey
No API key could be resolved from config or environment.
Sdk(String)
Network / decode failures (retryable on network errors).
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns true if this error is retryable per the spec retry policy.
Sourcepub fn retry_after_seconds(&self) -> Option<f64>
pub fn retry_after_seconds(&self) -> Option<f64>
Returns the Retry-After value if this error carries one.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for Error
impl RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl UnwindSafe for Error
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more