proof_of_sql/base/database/
owned_column_error.rs

1use crate::base::database::ColumnType;
2use alloc::string::String;
3use snafu::Snafu;
4
5/// Errors from operations related to `OwnedColumn`s.
6#[derive(Snafu, Debug, PartialEq, Eq)]
7pub enum OwnedColumnError {
8    /// Can not perform type casting.
9    #[snafu(display("Can not perform type casting from {from_type:?} to {to_type:?}"))]
10    TypeCastError {
11        /// The type from which we are trying to cast.
12        from_type: ColumnType,
13        /// The type to which we are trying to cast.
14        to_type: ColumnType,
15    },
16    /// Error in converting scalars to a given column type.   
17    #[snafu(display("Error in converting scalars to a given column type: {error}"))]
18    ScalarConversionError {
19        /// The underlying error
20        error: String,
21    },
22    /// Unsupported operation.
23    #[snafu(display("Unsupported operation: {error}"))]
24    Unsupported {
25        /// The underlying error
26        error: String,
27    },
28}
29
30/// Errors that can occur when coercing a column.
31#[derive(Snafu, Debug, PartialEq, Eq)]
32pub(crate) enum ColumnCoercionError {
33    /// Overflow when coercing a column.
34    #[snafu(display("Overflow when coercing a column"))]
35    Overflow,
36    /// Invalid type coercion.
37    #[snafu(display("Invalid type coercion"))]
38    InvalidTypeCoercion,
39}
40
41/// Result type for operations related to `OwnedColumn`s.
42pub type OwnedColumnResult<T> = core::result::Result<T, OwnedColumnError>;