ckb_indexer_sync/
error.rs

1//!The error type for Indexer.
2use thiserror::Error;
3
4/// A list specifying general categories of Indexer error.
5#[derive(Error, Debug)]
6pub enum Error {
7    /// Underlying DB error
8    #[error("Db error {0}")]
9    DB(String),
10    /// Invalid params error
11    #[error("Invalid params {0}")]
12    Params(String),
13}
14
15impl Error {
16    /// Creates a new Indexer Params error from an string payload.
17    pub fn invalid_params<S>(s: S) -> Error
18    where
19        S: Into<String>,
20    {
21        Error::Params(s.into())
22    }
23}
24
25impl From<rocksdb::Error> for Error {
26    fn from(e: rocksdb::Error) -> Error {
27        Error::DB(e.to_string())
28    }
29}