Skip to main content

data_preprocess/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum DataError {
5    #[error("DuckDB error: {0}")]
6    DuckDb(#[from] duckdb::Error),
7
8    #[error("CSV error: {0}")]
9    Csv(#[from] csv::Error),
10
11    #[error("IO error: {0}")]
12    Io(#[from] std::io::Error),
13
14    #[error("Invalid timestamp: {0}")]
15    InvalidTimestamp(String),
16
17    #[error("Invalid timeframe: {0}")]
18    InvalidTimeframe(String),
19
20    #[error("Could not extract symbol from filename: {0}")]
21    SymbolExtraction(String),
22
23    #[error("Parse error in {file}:{line} — {message}")]
24    ParseError {
25        file: String,
26        line: usize,
27        message: String,
28    },
29
30    #[error("{0}")]
31    Other(String),
32}
33
34pub type Result<T> = std::result::Result<T, DataError>;