Skip to main content

transferred_core/
error.rs

1use thiserror::Error;
2
3/// Root error type. Every fallible operation in `el` returns `Result<T, ElError>`.
4/// Maps to Python `el.ElError` at the FFI boundary.
5#[derive(Debug, Error)]
6pub enum ElError {
7    #[error("source error: {0}")]
8    Source(String),
9
10    #[error("destination error: {0}")]
11    Destination(String),
12
13    #[error("io error: {0}")]
14    Io(#[from] std::io::Error),
15
16    #[error("arrow error: {0}")]
17    Arrow(#[from] arrow::error::ArrowError),
18
19    #[error("{0}")]
20    Other(String),
21}
22
23impl ElError {
24    pub fn source<S: Into<String>>(msg: S) -> Self {
25        Self::Source(msg.into())
26    }
27
28    pub fn destination<S: Into<String>>(msg: S) -> Self {
29        Self::Destination(msg.into())
30    }
31
32    pub fn other<S: Into<String>>(msg: S) -> Self {
33        Self::Other(msg.into())
34    }
35}