mos_core/error.rs
1//! The crate-level error type and `Result` alias.
2//!
3//! [`CoreError`] is a convenience error for crates that want a single
4//! `Result` without inventing their own; it wraps a [`Diagnostic`] or an
5//! `Unimplemented` marker.
6
7use crate::Diagnostic;
8
9/// Convenience top-level error type for crates that want a single
10/// `Result` alias without inventing their own.
11///
12/// # Examples
13///
14/// ```
15/// use mos_core::CoreError;
16///
17/// let err = CoreError::Unimplemented("cache");
18///
19/// assert_eq!(err.to_string(), "not yet implemented: cache");
20/// ```
21#[derive(thiserror::Error, Debug)]
22pub enum CoreError {
23 #[error("not yet implemented: {0}")]
24 Unimplemented(&'static str),
25
26 #[error(transparent)]
27 Diagnostic(Box<Diagnostic>),
28}
29
30pub type Result<T> = std::result::Result<T, CoreError>;