Skip to main content

context_forge/
error.rs

1//! Crate-wide error type.
2
3use thiserror::Error;
4
5/// All errors that can originate from this crate.
6#[derive(Debug, Error)]
7#[non_exhaustive]
8pub enum Error {
9    /// An error from the underlying `SQLite` database.
10    #[error("storage error: {0}")]
11    Sqlite(#[from] rusqlite::Error),
12
13    /// An error obtaining a connection from the connection pool.
14    #[error("connection pool error: {0}")]
15    Pool(#[from] r2d2::Error),
16
17    /// An entry failed validation.
18    #[error("invalid entry: {0}")]
19    InvalidEntry(String),
20
21    /// A schema migration failed.
22    #[error("migration error: {0}")]
23    Migration(String),
24
25    /// A distillation operation failed.
26    #[error("distillation error: {0}")]
27    Distill(String),
28}