use zaino_fetch::jsonrpsee::error::TransportError;
use zaino_serve::server::error::ServerError;
use zaino_state::NodeBackedIndexerServiceError;
#[derive(Debug, thiserror::Error)]
pub enum IndexerError {
#[error("Server error: {0}")]
ServerError(#[from] ServerError),
#[error("Configuration error: {0}")]
ConfigError(String),
#[error("JSON RPSee connector error: {0}")]
TransportError(#[from] TransportError),
#[error("NodeBackedIndexerService error: {0}")]
NodeBackedIndexerServiceError(Box<NodeBackedIndexerServiceError>),
#[error("HTTP error: Invalid URI {0}")]
HttpError(#[from] http::Error),
#[error("Join handle error: Invalid URI {0}")]
TokioJoinError(#[from] tokio::task::JoinError),
#[error("Misc indexer error: {0}")]
MiscIndexerError(String),
#[cfg(feature = "prometheus")]
#[error("Metrics error: {0}")]
MetricsError(String),
#[error("Restart Zaino")]
Restart,
}
impl From<NodeBackedIndexerServiceError> for IndexerError {
fn from(value: NodeBackedIndexerServiceError) -> Self {
IndexerError::NodeBackedIndexerServiceError(Box::new(value))
}
}