-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy patherror.rs
37 lines (34 loc) · 1.05 KB
/
error.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use crate::{clients::common::ClientError, synchronizer::error::SynchronizerError};
#[derive(Debug, thiserror::Error)]
pub enum IndexerError {
#[error(transparent)]
ReqwestEventSourceError(#[from] reqwest_eventsource::Error),
#[error(transparent)]
ClientError(#[from] ClientError),
#[error(transparent)]
Other(#[from] anyhow::Error),
#[error(transparent)]
SynchronizerError(#[from] SynchronizerError),
#[error("{0}")]
SerdeError(#[from] serde_json::Error),
#[error("Unexpected event \"{event}\" received")]
UnexpectedEvent { event: String },
}
#[derive(Debug, thiserror::Error)]
pub enum IndexingTaskError {
#[error("Indexing task {task_name} failed: {error}")]
FailedIndexingTask {
task_name: String,
error: IndexerError,
},
}
impl From<IndexingTaskError> for IndexerError {
fn from(error: IndexingTaskError) -> Self {
match error {
IndexingTaskError::FailedIndexingTask {
task_name: _,
error,
} => error,
}
}
}