@@ -5,6 +5,9 @@ pub trait DeterministicError: std::fmt::Debug + std::fmt::Display + Send + Sync
5
5
6
6
impl DeterministicError for SubgraphError { }
7
7
8
+ /// An error happened during processing and we need to classify errors into
9
+ /// deterministic and non-deterministic errors. This struct holds the result
10
+ /// of that classification
8
11
#[ derive( thiserror:: Error , Debug ) ]
9
12
pub enum ProcessingError {
10
13
#[ error( "{0:#}" ) ]
@@ -24,18 +27,18 @@ impl ProcessingError {
24
27
matches ! ( self , ProcessingError :: Deterministic ( _) )
25
28
}
26
29
}
27
-
28
- pub ( crate ) trait ErrorHelper < T , E > {
30
+ /// Implement this for errors that are always non-deterministic.
31
+ pub ( crate ) trait NonDeterministicErrorHelper < T , E > {
29
32
fn non_deterministic ( self : Self ) -> Result < T , ProcessingError > ;
30
33
}
31
34
32
- impl < T > ErrorHelper < T , anyhow:: Error > for Result < T , anyhow:: Error > {
35
+ impl < T > NonDeterministicErrorHelper < T , anyhow:: Error > for Result < T , anyhow:: Error > {
33
36
fn non_deterministic ( self ) -> Result < T , ProcessingError > {
34
37
self . map_err ( |e| ProcessingError :: Unknown ( e) )
35
38
}
36
39
}
37
40
38
- impl < T > ErrorHelper < T , StoreError > for Result < T , StoreError > {
41
+ impl < T > NonDeterministicErrorHelper < T , StoreError > for Result < T , StoreError > {
39
42
fn non_deterministic ( self ) -> Result < T , ProcessingError > {
40
43
self . map_err ( |e| ProcessingError :: Unknown ( Error :: from ( e) ) )
41
44
}
0 commit comments