Skip to content

Commit 284b4ce

Browse files
committed
core: Rename ErrorHelper
1 parent 9f65b22 commit 284b4ce

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

core/src/subgraph/error.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ pub trait DeterministicError: std::fmt::Debug + std::fmt::Display + Send + Sync
55

66
impl DeterministicError for SubgraphError {}
77

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
811
#[derive(thiserror::Error, Debug)]
912
pub enum ProcessingError {
1013
#[error("{0:#}")]
@@ -24,18 +27,18 @@ impl ProcessingError {
2427
matches!(self, ProcessingError::Deterministic(_))
2528
}
2629
}
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> {
2932
fn non_deterministic(self: Self) -> Result<T, ProcessingError>;
3033
}
3134

32-
impl<T> ErrorHelper<T, anyhow::Error> for Result<T, anyhow::Error> {
35+
impl<T> NonDeterministicErrorHelper<T, anyhow::Error> for Result<T, anyhow::Error> {
3336
fn non_deterministic(self) -> Result<T, ProcessingError> {
3437
self.map_err(|e| ProcessingError::Unknown(e))
3538
}
3639
}
3740

38-
impl<T> ErrorHelper<T, StoreError> for Result<T, StoreError> {
41+
impl<T> NonDeterministicErrorHelper<T, StoreError> for Result<T, StoreError> {
3942
fn non_deterministic(self) -> Result<T, ProcessingError> {
4043
self.map_err(|e| ProcessingError::Unknown(Error::from(e)))
4144
}

core/src/subgraph/runner.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::subgraph::context::IndexingContext;
2-
use crate::subgraph::error::{ErrorHelper as _, ProcessingError};
2+
use crate::subgraph::error::{NonDeterministicErrorHelper as _, ProcessingError};
33
use crate::subgraph::inputs::IndexingInputs;
44
use crate::subgraph::state::IndexingState;
55
use crate::subgraph::stream::new_block_stream;

0 commit comments

Comments
 (0)