Skip to main content

trx_rs/
error.rs

1use std::path::PathBuf;
2
3/// All errors that can occur in trx-rs.
4#[derive(Debug, thiserror::Error)]
5pub enum TrxError {
6    #[error("I/O error: {0}")]
7    Io(#[from] std::io::Error),
8
9    #[error("ZIP error: {0}")]
10    Zip(#[from] zip::result::ZipError),
11
12    #[error("JSON error: {0}")]
13    Json(#[from] serde_json::Error),
14
15    #[error("format error: {0}")]
16    Format(String),
17
18    #[error("unsupported dtype: {0}")]
19    DType(String),
20
21    #[error("invalid argument: {0}")]
22    Argument(String),
23
24    #[error("file not found: {}", .0.display())]
25    FileNotFound(PathBuf),
26}
27
28pub type Result<T> = std::result::Result<T, TrxError>;