#[non_exhaustive]pub enum Error {
InvalidInput(String),
Dns(String),
Network(String),
Timeout(u64),
Unsupported(String),
Io(Error),
Other(String),
}Expand description
Errors produced by netscli-core operations.
Variants group failures by category rather than by call site so
consumers can write one match arm per kind of problem (Dns,
InvalidInput, etc.) instead of per specific operation.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidInput(String)
The caller supplied bad input (malformed IP, port 0, empty host, subnet too large, etc). Recoverable by the caller correcting the input.
Dns(String)
DNS resolution failed. Wraps the reason as a string because
hickory-resolver errors aren’t Clone and their variants
aren’t stable enough to re-export directly.
Network(String)
A socket-level network operation failed (connection refused, unreachable, host down, etc).
Timeout(u64)
An operation exceeded its configured timeout. The value is the timeout that was hit, in milliseconds.
Unsupported(String)
The requested operation isn’t available in this build (e.g.
packet capture without the pcap feature) or on this platform.
Io(Error)
Standard I/O error (file open, file write, socket bind, etc).
Other(String)
Fallback for errors that haven’t been categorised yet.
New variants will land here and move out as modules convert
from anyhow::Error to this type.
Implementations§
Source§impl Error
impl Error
Sourcepub fn invalid_input<T: Display>(msg: T) -> Self
pub fn invalid_input<T: Display>(msg: T) -> Self
Convenience constructor for Error::InvalidInput that accepts
anything Displayable so call sites stay terse.
Sourcepub fn unsupported<T: Display>(msg: T) -> Self
pub fn unsupported<T: Display>(msg: T) -> Self
Convenience constructor for Error::Unsupported.
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()
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