pub enum Error {
Io(Error),
Json(Error),
Internal(String),
}Expand description
Errors returned by Spectra storage, routing, serialization, and I/O paths.
Backend-specific failures that do not map to I/O or JSON are reported as
Internal with their original message.
§Examples
use spectra_core::Error;
let error = Error::Internal("metrics backend is required".into());
assert_eq!(error.to_string(), "metrics backend is required");
match error {
Error::Internal(message) => assert!(message.contains("backend")),
Error::Io(_) | Error::Json(_) => unreachable!(),
}Variants§
Io(Error)
Underlying filesystem or stream I/O failure.
Json(Error)
JSON serialization or deserialization failure.
Internal(String)
Catch-all internal error with a message.
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)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
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
Mutably borrows from an owned value. Read more