iota_data_ingestion_core/
errors.rs

1// Copyright (c) 2024 IOTA Stiftung
2// SPDX-License-Identifier: Apache-2.0
3
4pub type IngestionResult<T, E = IngestionError> = core::result::Result<T, E>;
5
6// TODO: make first letter lower-case to all messages
7#[derive(Debug, thiserror::Error)]
8#[non_exhaustive]
9pub enum IngestionError {
10    #[error(transparent)]
11    ObjectStore(#[from] object_store::Error),
12
13    #[error(transparent)]
14    Url(#[from] url::ParseError),
15
16    #[error(transparent)]
17    Io(#[from] std::io::Error),
18
19    #[error(transparent)]
20    Bcs(#[from] bcs::Error),
21
22    #[error(transparent)]
23    Json(#[from] serde_json::Error),
24
25    #[error(transparent)]
26    RestApi(#[from] iota_rest_api::client::sdk::Error),
27
28    #[error("Register at least one worker pool")]
29    EmptyWorkerPool,
30
31    #[error("{component} shutdown error: `{msg}`")]
32    Shutdown { component: String, msg: String },
33
34    #[error("Channel error: `{0}`")]
35    Channel(String),
36
37    #[error("Checkpoint processing failed: `{0}`")]
38    CheckpointProcessing(String),
39
40    #[error("Checkpoint hook processing failed: `{0}`")]
41    CheckpointHookProcessing(String),
42
43    #[error("Progress Store error: `{0}`")]
44    ProgressStore(String),
45
46    #[error("Reducer error: `{0}`")]
47    Reducer(String),
48
49    #[error("Deserialize checkpoint failed: `{0}`")]
50    DeserializeCheckpoint(String),
51
52    #[error(transparent)]
53    Upstream(#[from] anyhow::Error),
54
55    #[error("reading historical data failed: `{0}`")]
56    HistoryRead(String),
57}