Better structure.
This commit is contained in:
@@ -117,23 +117,20 @@ where
|
||||
}
|
||||
|
||||
fn classify_delete_error(error: DatabaseError) -> RepositoryError {
|
||||
let is_recurring_transaction_reference = matches!(
|
||||
&error,
|
||||
match &error {
|
||||
DatabaseError::ForeignKeyViolation {
|
||||
constraint: Constraint::RecurringTransactionSourceAccount
|
||||
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)
|
||||
_ => RepositoryError::Database(error),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user