use zaino_fetch::jsonrpsee::error::TransportError;
use zaino_serve::server::error::ServerError;
#[allow(deprecated)]
use zaino_state::{FetchServiceError, StateServiceError};
#[derive(Debug, thiserror::Error)]
#[allow(deprecated)]
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("FetchService error: {0}")]
FetchServiceError(Box<FetchServiceError>),
#[error("StateService error: {0}")]
StateServiceError(Box<StateServiceError>),
#[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),
#[error("Restart Zaino")]
Restart,
}
#[allow(deprecated)]
impl From<StateServiceError> for IndexerError {
fn from(value: StateServiceError) -> Self {
IndexerError::StateServiceError(Box::new(value))
}
}
#[allow(deprecated)]
impl From<FetchServiceError> for IndexerError {
fn from(value: FetchServiceError) -> Self {
IndexerError::FetchServiceError(Box::new(value))
}
}