#[non_exhaustive]pub enum Error {
Show 17 variants
BadRequest(Box<ApiError>),
Validation(Box<ApiError>),
Authentication(Box<ApiError>),
PermissionDenied(Box<ApiError>),
NotFound(Box<ApiError>),
Conflict(Box<ApiError>),
RateLimit(Box<ApiError>),
Server(Box<ApiError>),
Api(Box<ApiError>),
Connection(Box<dyn Error + Send + Sync>),
Timeout(Duration),
OperationFailed(Box<OperationFailure>),
WaitTimeout {
kind: &'static str,
id: String,
waited: Duration,
},
WebhookVerification(String),
InvalidInput(String),
Io(Error),
Decode(String),
}Expand description
Every error this SDK returns.
HTTP errors from the API are split by status into Error::BadRequest, Error::Validation,
Error::Authentication, Error::PermissionDenied, Error::NotFound,
Error::Conflict, Error::RateLimit and Error::Server; any other status is
Error::Api. Each carries an ApiError with the status, code, message, reference id,
details and response headers. Use Error::status, Error::code and
Error::reference_id to inspect any variant without matching.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BadRequest(Box<ApiError>)
400: the request was malformed.
Validation(Box<ApiError>)
422, or a 400 that reports invalid input (for example an invalid tool parameter).
Authentication(Box<ApiError>)
401: the API key is missing, invalid, expired or revoked.
PermissionDenied(Box<ApiError>)
403: the key lacks a scope, or the plan does not include the feature.
NotFound(Box<ApiError>)
404: the resource does not exist in this workspace and environment.
Conflict(Box<ApiError>)
409: the request conflicts with the resource’s current state.
RateLimit(Box<ApiError>)
429: too many requests. ApiError::retry_after says how long to wait.
Server(Box<ApiError>)
5xx: the API failed. These are retried automatically before they reach you.
Api(Box<ApiError>)
Any other HTTP error status (for example 413 for a file above the size limit).
Connection(Box<dyn Error + Send + Sync>)
The request could not be sent or the response could not be read (DNS, TCP, TLS).
Timeout(Duration)
The server did not answer within the request timeout.
OperationFailed(Box<OperationFailure>)
An operation or workflow run ended failed or cancelled.
WaitTimeout
Waiting for an operation or run took longer than the wait limit. The work goes on
server-side; resume with DocumentOperations::wait
or WorkflowRuns::wait.
Fields
WebhookVerification(String)
A webhook delivery failed signature or timestamp verification.
InvalidInput(String)
The arguments cannot be sent as given (checked before any request is made).
Io(Error)
Reading or writing a local file failed.
Decode(String)
A response body could not be decoded into the expected type.
Implementations§
Source§impl Error
impl Error
Sourcepub fn code(&self) -> Option<&str>
pub fn code(&self) -> Option<&str>
The machine-readable error code: the API’s error.code, or the code an operation
failed with.
Sourcepub fn reference_id(&self) -> Option<&str>
pub fn reference_id(&self) -> Option<&str>
The reference id to quote to support.
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
How long the API asked to wait before retrying (429 and some 503 responses).
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether the same call may succeed if sent again later.
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()