#[non_exhaustive]pub enum Error {
Show 14 variants
Connection {
message: String,
kind: TransportErrorKind,
source: Option<Box<dyn Error + Send + Sync>>,
},
Request {
message: String,
code: Option<String>,
status: u16,
request: Option<Box<RequestMetadata>>,
},
Server {
message: String,
code: Option<String>,
status: u16,
request: Option<Box<RequestMetadata>>,
},
InputTooLong {
message: String,
model: Option<String>,
request: Option<Box<RequestMetadata>>,
},
ModelLoadFailed {
message: String,
model: Option<String>,
error_class: ModelLoadErrorClass,
permanent: bool,
attempts: u32,
request: Option<Box<RequestMetadata>>,
},
ResourceExhausted {
message: String,
model: Option<String>,
retries: u32,
request: Option<Box<RequestMetadata>>,
},
EstimateUnroutable {
message: String,
code: Option<String>,
request: Option<Box<RequestMetadata>>,
},
Provisioning {
message: String,
gpu: Option<String>,
retry_after: Option<Duration>,
},
ModelLoading {
message: String,
model: Option<String>,
},
LoraLoading {
message: String,
lora: Option<String>,
model: Option<String>,
},
Pool {
message: String,
pool_name: Option<String>,
state: Option<String>,
},
Decode(String),
InvalidRequest(String),
Io(Error),
}Expand description
Everything that can go wrong talking to a SIE server.
The variant fields are the failure’s evidence: message is what the server said,
code is its error code, status the HTTP status, and request the metering metadata
that survived. Read them through the accessors when you only need one.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Connection
The request never produced an HTTP response.
Request
A 4xx the SDK does not model more specifically.
Server
A 5xx the SDK does not model more specifically.
InputTooLong
The input exceeded the model’s context window (400 INPUT_TOO_LONG).
ModelLoadFailed
The worker could not load the model (502 MODEL_LOAD_FAILED).
ResourceExhausted
The server ran out of device memory and the SDK exhausted its retries.
EstimateUnroutable
/v1/estimate could not route the request to a rate identity.
Provisioning
No capacity, and either the caller opted out of waiting or the budget ran out.
ModelLoading
The model was still loading when the provision budget expired.
LoraLoading
A LoRA adapter was still loading after the retry cap.
Pool
A pool operation failed.
Decode(String)
A response body could not be decoded as the documented shape.
InvalidRequest(String)
The caller supplied arguments the SDK rejects before sending anything.
Io(Error)
Local I/O failed (reading a file to upload, for example).
Implementations§
Source§impl Error
impl Error
Sourcepub fn status(&self) -> Option<u16>
pub fn status(&self) -> Option<u16>
HTTP status that produced this error, when there was a response.
Sourcepub fn code(&self) -> Option<&str>
pub fn code(&self) -> Option<&str>
Server error code (X-SIE-Error-Code or the body’s code field).
Sourcepub fn request_metadata(&self) -> Option<&RequestMetadata>
pub fn request_metadata(&self) -> Option<&RequestMetadata>
Metadata the server attached to the failing request, when any survived parsing.
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
The server’s Retry-After hint, when it sent one and the SDK gave up anyway.
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
True for every failure the server attributed to itself (5xx family).
Sourcepub fn is_request_error(&self) -> bool
pub fn is_request_error(&self) -> bool
True for every failure the server attributed to the request (4xx family).
Sourcepub fn is_capacity_error(&self) -> bool
pub fn is_capacity_error(&self) -> bool
True when the SDK gave up waiting for capacity rather than hitting a hard failure.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()