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 id already exists")]
AccountIdAlreadyExists,
#[error("account id not found")]
AccountIdNotFound,
#[error("transaction id already exists")]
TransactionIdAlreadyExists,
#[error("scheduled transaction id already exists")]
ScheduledTransactionIdAlreadyExists,
#[error("app id already exists")]
AppIdAlreadyExists,
#[error("cannot remove the last member of an account")]
LastAccountMemberRemoval,
#[error("user id not found")]
UserIdNotFound,
#[error("invalid client credentials")]
InvalidClientCredentials,
#[error("invalid refresh token")]
InvalidRefreshToken,
#[error("not found")]
NotFound,
#[error("unknown")]
Unknown,
#[error(transparent)]
Domain(#[from] DomainError),
#[error(transparent)]
Extractor(#[from] ExtractorError),
#[error(transparent)]
Repository(#[from] RepositoryError),
#[error(transparent)]
Internal(#[from] anyhow::Error),
}