//! The error type shared by iz-core. `Invalid` and `Conflict` carry text that is safe to show the //! user; everything else is logged and answered with a generic page. /// Every failure iz-core reports. #[derive(Debug, thiserror::Error)] pub enum Error { /// Filesystem failure. #[error("io error: {0}")] Io(#[from] std::io::Error), /// A database statement failed. #[error("database error: {0}")] Database(String), /// A migration could not be applied or the history is inconsistent. #[error("migration error: {0}")] Migration(String), /// The configuration file is unreadable or fails validation. #[error("config error: {0}")] Config(String), /// Sealing, opening or the instance key failed. #[error("crypto error: {0}")] Crypto(String), /// The row or resource does not exist, or the viewer may not know that it exists. #[error("not found")] NotFound, /// The request conflicts with the current state (for example a stale move). #[error("conflict: {0}")] Conflict(String), /// The actor may not do this. #[error("forbidden: {0}")] Forbidden(String), /// A value broke a rule the user can fix (length, format, unknown zone). #[error("invalid value: {0}")] Invalid(String), } /// Result alias used across iz-core. pub type Result = std::result::Result;