Skip to main content

dactyl_db/
error.rs

1//! Public error type for dactyl.
2
3use thiserror::Error;
4
5use crate::query::Construct;
6
7/// All errors dactyl can raise on its public surface.
8#[derive(Debug, Error)]
9pub enum DactylError {
10    /// The query contains a dialect-specific construct the active adapter
11    /// does not support and `optimize = false` was passed.
12    #[error("dialect mismatch: construct `{construct:?}` not supported")]
13    Unsupported {
14        /// The unsupported construct.
15        construct: Construct,
16    },
17
18    /// The query string failed to parse under the analyzer's lexical rules.
19    #[error("invalid query: {0}")]
20    InvalidQuery(String),
21
22    /// Adapter-level failure. Wraps the underlying error message.
23    #[error("adapter error: {0}")]
24    Adapter(String),
25
26    /// Requested column or index was not found in the row.
27    #[error("column not found: {0}")]
28    ColumnNotFound(String),
29
30    /// Type conversion of column value failed.
31    #[error("conversion error: {0}")]
32    Conversion(String),
33}