eigen_client_fireblocks/
error.rs1use alloy::contract::Error as AlloyError;
2use jsonwebtoken::errors::Error;
3use reqwest::header::InvalidHeaderValue;
4use reqwest::Error as ReqwestError;
5use serde_json::Error as SerdeErr;
6use std::fmt;
7use thiserror::Error;
8
9#[derive(Debug, Error)]
11pub enum FireBlockError {
12 #[error("Failed to sign the jwt payload")]
14 JsonWebTokenError(Error),
15
16 #[error("Alloy error{0}")]
18 AlloyContractError(#[from] AlloyError),
19
20 #[error("Other Error {0}")]
21 OtherError(String),
22
23 #[error("Reqwest error {0}")]
25 ReqwestError(#[from] ReqwestError),
26
27 #[error("Invalid header value error {0}")]
29 InvalidHeaderValueError(#[from] InvalidHeaderValue),
30
31 #[error("Serde json error {0}")]
33 SerdeError(#[from] SerdeErr),
34
35 #[error("Chain Id not supported{0} . Create an issue at https://github.com/Layr-Labs/eigensdk-rs/issues/new")]
37 AssetIDError(String),
38
39 #[error("Account not found in whitelisted accounts {0}")]
41 AccountNotFoundError(String),
42
43 #[error("Contract {0} not found in whitelisted contract")]
45 ContractNotFound(String),
46
47 #[error("Transaction Failed with Status {0} , tx_id {1}")]
49 TransactionFailed(String, String),
50
51 #[error("Transaction to be broadcasted with Status {0} , tx_id {1}")]
53 NotBroadcasted(String, String),
54
55 #[error("Transaction not available yet with Status {0} , tx_id {1} ")]
57 ReceiptNotYetAvailable(String, String),
58
59 #[error("Transactin receipt not found with tx_id {0}")]
61 TransactionReceiptNotFound(String),
62}
63
64impl FireBlockError {
65 pub fn from<E: fmt::Display>(error: E) -> FireBlockError {
66 FireBlockError::OtherError(error.to_string())
67 }
68}
69
70impl From<&str> for FireBlockError {
71 fn from(err: &str) -> FireBlockError {
72 FireBlockError::OtherError(err.to_string())
73 }
74}