#[non_exhaustive]pub enum Error {
Io(Error),
Json(Error),
Storage {
message: String,
source: Option<Box<dyn Error + Send + Sync>>,
},
Config(String),
Internal(String),
PersistQueueClosed,
}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
Storage (with an optional Error::source chain) or
Config for builder/wiring mistakes. Internal
is reserved for invariant violations and parse bugs.
§Examples
use spectra_core::Error;
let error = Error::config("metrics backend is required");
assert_eq!(error.to_string(), "config error: metrics backend is required");
match error {
Error::Config(message) => assert!(message.contains("backend")),
Error::Io(_)
| Error::Json(_)
| Error::Storage { .. }
| Error::Internal(_)
| Error::PersistQueueClosed
| _ => {
unreachable!()
}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Io(Error)
Underlying filesystem or stream I/O failure.
Json(Error)
JSON serialization or deserialization failure.
Storage
Storage backend failure (SQLite, remote engine, etc.).
Fields
Config(String)
Builder, wiring, or configuration mistake.
Internal(String)
Catch-all for invariant violations and unexpected parse bugs.
PersistQueueClosed
Persist worker channel closed before a flush or enqueue ack completed.
Implementations§
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