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 selected a datastore that does not match the connection
19 /// route, or an inline override could not be resolved to a configured
20 /// route.
21 #[error("datastore routing error: {0}")]
22 Routing(String),
23
24 /// The requested backend-neutral operation is not available for the
25 /// selected adapter.
26 #[error("unsupported datastore operation: {0}")]
27 UnsupportedOperation(String),
28
29 /// The query string failed to parse under the analyzer's lexical rules.
30 #[error("invalid query: {0}")]
31 InvalidQuery(String),
32
33 /// Adapter-level failure. Wraps the underlying error message.
34 #[error("adapter error: {0}")]
35 Adapter(String),
36
37 /// Requested column or index was not found in the row.
38 #[error("column not found: {0}")]
39 ColumnNotFound(String),
40
41 /// Type conversion of column value failed.
42 #[error("conversion error: {0}")]
43 Conversion(String),
44}