proof_of_sql/base/database/
expression_evaluation_error.rs

1use crate::base::{database::ColumnOperationError, math::decimal::DecimalError};
2use alloc::string::String;
3use core::result::Result;
4use snafu::Snafu;
5
6/// Errors from evaluation of `Expression`s.
7#[derive(Snafu, Debug, PartialEq, Eq)]
8pub enum ExpressionEvaluationError {
9    /// Column not found
10    #[snafu(display("Column not found: {error}"))]
11    ColumnNotFound {
12        /// The underlying error
13        error: String,
14    },
15    /// Error in column operation
16    #[snafu(transparent)]
17    ColumnOperationError {
18        /// The underlying source error
19        source: ColumnOperationError,
20    },
21    /// Expression not yet supported
22    #[snafu(display("Expression {expression} is not supported yet"))]
23    Unsupported {
24        /// The unsupported expression
25        expression: String,
26    },
27    /// Error in decimal conversion
28    #[snafu(transparent)]
29    DecimalConversionError {
30        /// The underlying source error
31        source: DecimalError,
32    },
33}
34
35/// Result type for expression evaluation
36pub type ExpressionEvaluationResult<T> = Result<T, ExpressionEvaluationError>;