#[non_exhaustive]pub enum Error {
Unaskable {
what: String,
detail: String,
},
Bus {
op: &'static str,
target: String,
source: BoxedCause,
},
Io {
path: PathBuf,
source: Error,
},
Malformed {
what: String,
detail: String,
source: Option<BoxedCause>,
},
Internal(String),
}Expand description
Why a fleet operation could not answer.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Unaskable
The caller’s input was refused; nothing was attempted. A selector that is not a key expression, a name outside a closed vocabulary, a window of zero seconds, a hostname where an origin belongs.
This is the variant that carries RFC 13 §1’s “the question could not be asked”, and the only one a caller fixes by changing what it passed.
Fields
Bus
A bus operation failed: a declare, a get, a put, an undeclare.
The question was asked and the fabric did not carry it. Distinct from
Unaskable because retrying is meaningful.
Fields
op: &'static strThe operation, phrased so that {op} {target} reads as the thing
that failed — subscribe v1/**, declare queryable …, failed to open the Zenoh session. It is a label, not a zenoh API name.
source: BoxedCauseIo
Local filesystem I/O — a .zrec, a registry directory, a config.
Carries the path where there is one, and the io::ErrorKind is
reachable through source: “no such
directory” and “permission denied” are different answers to give a
user.
The path may be empty, and the Display says so rather than
rendering to nothing: a writer generic over W: Write (the .zrec
sink) genuinely does not know where its bytes are going. An error
whose Display is the empty string is not a smaller error — it is a
blank Error: line and a blank Caused by: under it.
Malformed
Bytes arrived and could not be read as what they claim to be — a
.zrec header, a served slice, a reply payload.
Not the caller’s fault and not the fabric’s: a peer said something this build cannot parse.
Fields
detail: StringThis crate’s own words — short, because the parser’s own message
rides underneath as the source.
source: Option<BoxedCause>Internal(String)
An invariant of this crate did not hold.
Every construction site is a place the old code said “a bug in
blob_*” or “tasks outlived the run”. Kept as a variant rather than a
panic because an explorer that has found a bug in its own engine
should still be able to report it rather than die mid-sweep.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_unaskable(&self) -> bool
pub fn is_unaskable(&self) -> bool
The caller’s input was refused and nothing was attempted — RFC 13 §1’s “the question could not be asked”.
zenctl maps this to its reserved exit 2. It is a method rather than
a matches! at the call site so the mapping has one home, the way
judgement_exit_code does for verdicts.
Sourcepub fn unaskable(what: impl Into<String>, detail: impl Into<String>) -> Error
pub fn unaskable(what: impl Into<String>, detail: impl Into<String>) -> Error
An input this crate refuses.
Sourcepub fn unaskable_from(
what: impl Into<String>,
cause: impl Into<BoxedCause>,
) -> Error
pub fn unaskable_from( what: impl Into<String>, cause: impl Into<BoxedCause>, ) -> Error
An input this crate refuses, explained by the error that refused it — a key-expression parse, a number that would not parse.
Sourcepub fn bus(
op: &'static str,
target: impl Into<String>,
cause: impl Into<BoxedCause>,
) -> Error
pub fn bus( op: &'static str, target: impl Into<String>, cause: impl Into<BoxedCause>, ) -> Error
A bus operation that failed.
Sourcepub fn malformed(what: impl Into<String>, detail: impl Into<String>) -> Error
pub fn malformed(what: impl Into<String>, detail: impl Into<String>) -> Error
Bytes that did not read as what they claimed to be.
Sourcepub fn malformed_from(
what: impl Into<String>,
cause: impl Into<BoxedCause>,
) -> Error
pub fn malformed_from( what: impl Into<String>, cause: impl Into<BoxedCause>, ) -> Error
Likewise, keeping the parser’s own error underneath — where a span or a line number is worth reaching for.
Sourcepub fn malformed_with(
what: impl Into<String>,
detail: impl Into<String>,
cause: impl Into<BoxedCause>,
) -> Error
pub fn malformed_with( what: impl Into<String>, detail: impl Into<String>, cause: impl Into<BoxedCause>, ) -> Error
malformed_from where the caller has a better
sentence than “does not parse” — is not a header, is not a slice.
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<SliceError> for Error
A served slice that does not parse is a peer saying something
unreadable, never a local mistake — RFC 08 §6’s introspect reply.
impl From<SliceError> for Error
A served slice that does not parse is a peer saying something unreadable, never a local mistake — RFC 08 §6’s introspect reply.
Source§fn from(e: SliceError) -> Error
fn from(e: SliceError) -> Error
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<Source> AccessAs for Source
impl<Source> AccessAs for Source
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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