Files
expenses/server/src/error.rs
T

50 lines
1.1 KiB
Rust

use crate::{domain::DomainError, repository::RepositoryError, routes::extractors::ExtractorError};
#[derive(Debug, thiserror::Error)]
pub enum AppError {
#[error("account not found")]
AccountNotFound,
#[error("user not found")]
UserNotFound,
#[error("account id already exists")]
AccountIdAlreadyExists,
#[error("app id already exists")]
AppIdAlreadyExists,
#[error("scheduled transaction id already exists")]
ScheduledTransactionIdAlreadyExists,
#[error("transaction id already exists")]
TransactionIdAlreadyExists,
#[error("invalid client credentials")]
InvalidClientCredentials,
#[error("invalid refresh token")]
InvalidRefreshToken,
#[error("not found")]
NotFound,
#[error("race condition occurred")]
RaceCondition,
#[error("unknown")]
Unknown,
#[error(transparent)]
Domain(#[from] DomainError),
#[error(transparent)]
Extractor(#[from] ExtractorError),
#[error(transparent)]
Repository(#[from] RepositoryError),
#[error(transparent)]
Internal(#[from] anyhow::Error),
}