pub struct Error { /* private fields */ }Expand description
A failure, classified once at the point it is raised.
Carries the coarse ErrorKind every consumer branches on, the optional
WireKind naming the daemon status that produced it, a message that names
the docs/PLATFORM.md finding when a trap closure raised it, and the
underlying error when one exists.
Deliberately a struct with a private body rather than an enum: the variants a caller wants to match on are the kinds, and an enum over every raise site would make every new failure a breaking change for a binding that matched exhaustively.
Implementations§
Source§impl Error
impl Error
Sourcepub fn new(kind: ErrorKind, message: impl Into<String>) -> Error
pub fn new(kind: ErrorKind, message: impl Into<String>) -> Error
A failure of kind, with a message that should name its finding.
Sourcepub fn invalid_arg(message: impl Into<String>) -> Error
pub fn invalid_arg(message: impl Into<String>) -> Error
A local reject: the request was refused before any AWS call.
The shorthand exists because every trap closure in this crate ends in one,
and ERR_INVALID_ARG is the code that tells a caller the fix is theirs and
costs nothing.
Sourcepub fn with_source(self, source: impl Error + Send + Sync + 'static) -> Error
pub fn with_source(self, source: impl Error + Send + Sync + 'static) -> Error
Attaches the underlying error, reachable through std::error::Error::source.
Sourcepub fn with_throttled(self, throttled: bool) -> Error
pub fn with_throttled(self, throttled: bool) -> Error
Marks a control-plane throttle without parsing its explanation.
Sourcepub fn with_retry_details(self, attempts: u32, backoff: Duration) -> Error
pub fn with_retry_details(self, attempts: u32, backoff: Duration) -> Error
Attaches the attempts and completed retry sleeps for this control-plane call.
Sourcepub fn attempt_count(&self) -> u32
pub fn attempt_count(&self) -> u32
Attempts sent for the failed call, or zero when no request telemetry is available.
Sourcepub fn wire_kind(&self) -> Option<WireKind>
pub fn wire_kind(&self) -> Option<WireKind>
The daemon status this came from, when it came from one.
None for every local reject and every control-plane failure — those never
reached the in-VM daemon, so there is no status to report.
Sourcepub fn code(&self) -> &'static str
pub fn code(&self) -> &'static str
The machine-readable ERR_* code, as cli.py’s Code spells it.
Sourcepub fn retryable(&self) -> bool
pub fn retryable(&self) -> bool
Whether retrying the identical request could plausibly succeed.
Derived from the kind rather than stored, so it cannot drift from it: the
five retryable daemon conditions all map to ErrorKind::Retryable, which
is what makes this one comparison instead of a second table.
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()
Source§impl From<ProvisionError> for Error
The taxonomy error a binding raises: the message, then each remedy, since a binding’s
exception has nowhere else to carry them.
impl From<ProvisionError> for Error
The taxonomy error a binding raises: the message, then each remedy, since a binding’s exception has nowhere else to carry them.
Source§fn from(error: ProvisionError) -> Error
fn from(error: ProvisionError) -> Error
Source§impl From<WorkspaceError> for Error
impl From<WorkspaceError> for Error
Source§fn from(error: WorkspaceError) -> Error
fn from(error: WorkspaceError) -> Error
ERR_INVALID_ARG: the tree is the caller’s, and so is the fix (a smaller tree, a
readable path, a writable destination). Nothing the daemon said is involved.
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin 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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more