Change object model and add crate Error type
This commit is contained in:
+26
@@ -2,3 +2,29 @@ mod transaction;
|
||||
pub use transaction::Transaction;
|
||||
pub mod csv;
|
||||
pub mod ynab;
|
||||
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum Error {
|
||||
#[error("HTTP Error: {0}")]
|
||||
Http(#[from] reqwest::Error),
|
||||
#[error("parse error: {0}")]
|
||||
Parse(#[from] serde_json::Error),
|
||||
#[error("csv error: {0}")]
|
||||
Csv(#[from] ::csv::Error),
|
||||
#[error("io error: {0}")]
|
||||
Io(#[from] std::io::Error),
|
||||
#[error("couldn't parse amount: {0}")]
|
||||
AmountParse(#[from] std::num::ParseIntError),
|
||||
|
||||
#[error("plan not found: {0}")]
|
||||
PlanNotFound(String),
|
||||
#[error("account not found: {0}")]
|
||||
AccountNotFound(String),
|
||||
#[error("empty amount")]
|
||||
AmountEmpty,
|
||||
#[error("bank format not found: {0}")]
|
||||
BankFormat(String),
|
||||
/// Errors I've been too lazy to give a type yet
|
||||
#[error("{0}")]
|
||||
Text(String),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user