//! Domain error types for the CMS crate. //! //! Typed error enums for repository and service operations. //! The `RepositoryError` type is re-exported from `zesdex_utils::Error`, //! which has all needed variants: `NotFound`, `Conflict`, `Io`, `Serde`, //! `InvalidId`, `Other`, etc. //! //! `From` impls are generated by `thiserror::Error` derive macros. //! Anyhow's blanket `From` //! covers conversion to `anyhow::Error` for downstream code. // --------------------------------------------------------------------------- // RepositoryError (type alias) // --------------------------------------------------------------------------- /// Re-export shared repository error from `zesdex_utils`. pub use zesdex_utils::Error as RepositoryError; // `From for anyhow::Error` is covered by anyhow's blanket // `impl From for Error` — no // explicit impl needed. // --------------------------------------------------------------------------- // ServiceError // --------------------------------------------------------------------------- /// Errors from service / use-case operations in the CMS domain. #[derive(Debug, thiserror::Error)] pub enum ServiceError { /// A repository operation failed. #[error("repository error: {0}")] Repository(#[from] RepositoryError), /// The provided input is invalid. #[error("invalid input: {0}")] InvalidInput(String), /// A generic error with a message. #[error("{0}")] Other(String), } // `From for anyhow::Error` is covered by anyhow's blanket impl.