1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use std::result::Result as StdResult;
use thiserror::Error as ThisError;

#[derive(Debug, ThisError)]
pub enum Error {
    #[error("Unexpected length. Expected {expected} got {got}.")]
    UnexpectedLength { expected: usize, got: usize },
    #[error("Failed to decode hex string:\n{0}")]
    DecodeHex(faster_hex::Error),
    #[error("Invalid hex prefix. Hex string doesn't start with \"0x\". Value was: \"{0}\"")]
    InvalidHexPrefix(String),
    #[error("Unknown transaction status: {0}")]
    UnknownTransactionStatus(String),
    #[error("Unknown transaction type: {0}")]
    UnknownTransactionType(String),
    #[error("Unexpected quantity. Value was: {0}")]
    UnexpectedQuantity(String),
    #[error("Invalid Number from Hex. {0}")]
    DecodeNumberFromHex(String),
}

pub type Result<T> = StdResult<T, Error>;