financial_ops/core/
error.rs1use std::{
2 error::Error,
3 fmt::{self, Display, Formatter},
4};
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8pub enum DecimalOperationError {
9 Overflow,
11 DivisionByZero,
13}
14
15impl Display for DecimalOperationError {
16 fn fmt(&self, f: &mut Formatter) -> fmt::Result {
17 match self {
18 DecimalOperationError::Overflow => {
19 write!(f, "An overflow occurred during the operation.")
20 }
21 DecimalOperationError::DivisionByZero => {
22 write!(f, "A division by zero occurred during the operation.")
23 }
24 }
25 }
26}
27
28impl Error for DecimalOperationError {}