#[non_exhaustive]pub enum Error {
Api(Box<ApiError>),
Job(Box<JobError>),
Timeout {
job_id: Option<Uuid>,
},
Transport(Error),
Decode {
status: Option<u16>,
message: String,
},
Config(String),
InvalidRequest(String),
Io {
path: PathBuf,
source: Error,
},
}Expand description
Every way an SDK call can fail.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Api(Box<ApiError>)
The API refused the request (a non-2xx response).
Job(Box<JobError>)
The job finished failed or canceled.
Timeout
A wait ran out of time. The job is NOT canceled and keeps running (and is billed); wait again, or cancel it.
Transport(Error)
The request never got a response (DNS, TLS, connection, timeout). The URL is stripped: signed URLs carry credentials in the query string.
Decode
A success response whose body did not decode.
Config(String)
The client could not be built (missing API key, bad header value, …).
InvalidRequest(String)
A request the SDK refused to send (for example a request builder with a missing required field).
Io
A file could not be read or written.
Implementations§
Source§impl Error
impl Error
Sourcepub fn code(&self) -> Option<&ErrorCode>
pub fn code(&self) -> Option<&ErrorCode>
The API’s machine-readable code, from a refusal or a failed job.
Sourcepub fn is_out_of_credits(&self) -> bool
pub fn is_out_of_credits(&self) -> bool
See ApiError::is_out_of_credits; also true for a job that failed
with out_of_credits.
Sourcepub fn is_plan_required(&self) -> bool
pub fn is_plan_required(&self) -> bool
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Sourcepub async fn from_api(err: Error<()>) -> Self
pub async fn from_api(err: Error<()>) -> Self
Convert an error from a generated (api) call, reading the refusal
body when there is one. crate::Typed::typed does this for you.
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()