Better structure.
This commit is contained in:
@@ -117,24 +117,22 @@ where
|
||||
}
|
||||
|
||||
fn classify_delete_error(error: DatabaseError) -> RepositoryError {
|
||||
let is_recurring_transaction_reference = matches!(
|
||||
if matches!(
|
||||
&error,
|
||||
DatabaseError::ForeignKeyViolation {
|
||||
constraint: Constraint::RecurringTransactionSourceAccount
|
||||
| Constraint::RecurringTransactionDestinationAccount,
|
||||
..
|
||||
}
|
||||
);
|
||||
|
||||
if is_recurring_transaction_reference {
|
||||
RepositoryError::ReferenceViolation {
|
||||
) {
|
||||
return RepositoryError::ReferenceViolation {
|
||||
relation: ReferenceRelation::RecurringTransaction,
|
||||
kind: ReferenceViolationKind::StillReferenced,
|
||||
source: error,
|
||||
};
|
||||
}
|
||||
} else {
|
||||
|
||||
RepositoryError::Database(error)
|
||||
}
|
||||
}
|
||||
|
||||
fn decode(row: AccountRow) -> Result<Account, DecodeError> {
|
||||
|
||||
Reference in New Issue
Block a user