#[non_exhaustive]pub enum Error {
Transport(Error),
Api {
status_code: u16,
message: String,
},
Serialization(Error),
InvalidResponse(String),
ResponseTooLarge {
limit: usize,
},
NotCancellable,
OperationFailed {
id: Uuid,
status_code: u16,
err: Option<String>,
},
PreconditionFailed {
resource: String,
},
NotFound {
resource: String,
},
InvalidRequest(String),
WebSocketProtocol(String),
Timeout {
after: Duration,
request_fully_sent: bool,
},
}Expand description
Errors returned by crate::Client and every resource method built on
top of it.
#[non_exhaustive] because this crate expects to grow new failure modes
as more of the Incus API surface is covered - matching exhaustively on
this enum today would make every future variant addition a breaking
change for downstream crates.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Transport(Error)
Api
Serialization(Error)
InvalidResponse(String)
ResponseTooLarge
NotCancellable
OperationFailed
PreconditionFailed
NotFound
InvalidRequest(String)
WebSocketProtocol(String)
A WebSocket-level failure from the events feature’s
/1.0/events subscription that is not a plain socket I/O error
(those still map to Transport) - a protocol violation, oversized
frame, or similar. Kept separate from Transport so a caller can
tell “the connection itself broke” apart from “the daemon sent
something the WebSocket layer rejected” without string-matching.
Timeout
request_fully_sent tells a caller building retry logic whether the
request had already been fully written to the daemon when the
timeout fired: if true, a mutating call (create/update/delete) may
have already been received and acted on server-side even though the
caller only sees this timeout - retrying could duplicate the
operation. If false, nothing was sent and a retry is safe. Incus
operations are not inherently idempotent, so this distinction
matters for anything more than a manual “try again and see.”
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()