logic/operators/
error.rs

1#[derive(Debug)]
2pub enum BinaryError<L, R>
3where
4    L: std::error::Error,
5    R: std::error::Error,
6{
7    Left(L),
8    Right(R),
9}
10
11impl<L, R> std::fmt::Display for BinaryError<L, R>
12where
13    L: std::error::Error,
14    R: std::error::Error,
15{
16    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
17        match self {
18            Self::Left(left) => write!(f, "Left error: {}", left),
19            Self::Right(right) => write!(f, "Right error: {}", right),
20        }
21    }
22}
23
24impl<L, R> std::error::Error for BinaryError<L, R>
25where
26    L: std::error::Error,
27    R: std::error::Error,
28{
29}
30
31#[derive(Debug)]
32pub enum TimedOperatorError<E>
33where
34    E: std::error::Error,
35{
36    EmptyTrace,
37    SubformulaError(E),
38}
39
40impl<E> std::fmt::Display for TimedOperatorError<E>
41where
42    E: std::error::Error,
43{
44    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
45        match self {
46            Self::EmptyTrace => write!(f, "Not enough elements in trace provided to operator"),
47            Self::SubformulaError(error) => write!(f, "Subformula error {}", error),
48        }
49    }
50}
51
52impl<E> std::error::Error for TimedOperatorError<E> where E: std::error::Error {}