re_sorbet/
error.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
use arrow::error::ArrowError;

#[derive(thiserror::Error, Debug)]
pub enum SorbetError {
    #[error(transparent)]
    UnknownColumnKind(#[from] crate::UnknownColumnKind),

    #[error(transparent)]
    MissingMetadataKey(#[from] crate::MissingMetadataKey),

    #[error(transparent)]
    MissingFieldMetadata(#[from] crate::MissingFieldMetadata),

    #[error(transparent)]
    UnsupportedTimeType(#[from] crate::UnsupportedTimeType),

    #[error(transparent)]
    WrongDatatypeError(#[from] crate::WrongDatatypeError),

    #[error(transparent)]
    ArrowError(#[from] ArrowError),

    #[error("Bad chunk schema: {reason}")]
    Custom { reason: String },
}

impl SorbetError {
    pub fn custom(reason: impl Into<String>) -> Self {
        Self::Custom {
            reason: reason.into(),
        }
    }
}