//! The error type for `in-core`. `Invalid` and `Conflict` carry text meant for the user; every other //! variant becomes a generic 500 page with the cause logged. /// Every failure `in-core` reports. #[derive(Debug, thiserror::Error)] pub enum Error { /// A filesystem operation failed. #[error("io error: {0}")] Io(#[from] std::io::Error), /// The database rejected or failed a statement. #[error("database error: {0}")] Database(String), /// A schema migration could not be applied. #[error("migration error: {0}")] Migration(String), /// The configuration file is unreadable, malformed or fails validation. #[error("config error: {0}")] Config(String), /// Sealing, opening, hashing or the instance key failed. #[error("crypto error: {0}")] Crypto(String), /// The requested row does not exist, or the viewer may not know that it exists. #[error("not found")] NotFound, /// The write clashes with existing state, such as a name that is already taken. #[error("conflict: {0}")] Conflict(String), /// The actor is known but may not do this. #[error("forbidden: {0}")] Forbidden(String), /// The input is malformed or breaks a rule. #[error("invalid value: {0}")] Invalid(String), } /// Shorthand for results carrying [`Error`]. pub type Result = std::result::Result;