Change object model and add crate Error type

This commit is contained in:
2026-05-03 14:17:50 +02:00
parent a9de66a49f
commit fa4cc722e2
12 changed files with 283 additions and 247 deletions
+26
View File
@@ -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),
}