Skip to main content

ethrex_rpc/clients/auth/
errors.rs

1#[derive(Debug, thiserror::Error)]
2pub enum ConfigError {
3    #[error("Error deserializing config from env: {0}")]
4    ConfigDeserializationError(#[from] envy::Error),
5}
6
7#[derive(Debug, thiserror::Error)]
8pub enum EngineClientError {
9    #[error("Error sending request {0}")]
10    RequestError(String),
11    #[error("reqwest error: {0}")]
12    ReqwestError(#[from] reqwest::Error),
13    #[error("{0}")]
14    FailedDuringExchangeCapabilities(#[from] ExchangeCapabilitiesError),
15    #[error("{0}")]
16    FailedDuringForkChoiceUpdate(#[from] ForkChoiceUpdatedError),
17    #[error("{0}")]
18    FailedDuringGetPayload(#[from] GetPayloadError),
19    #[error("{0}")]
20    FailedDuringNewPayload(#[from] NewPayloadError),
21    #[error("EngineClient failed to prepare JWT: {0}")]
22    FailedToGetSystemTime(#[from] std::time::SystemTimeError),
23    #[error("EngineClient failed to decode JWT secret: {0}")]
24    FailedToDecodeJWTSecret(String),
25    #[error("EngineClient failed to encode JWT: {0}")]
26    FailedToEncodeJWT(#[from] jsonwebtoken::errors::Error),
27    #[error("EngineClient failed read secret: {0}")]
28    FailedToReadSecret(#[from] std::io::Error),
29    #[error("EngineClient failed to serialize request body: {0}")]
30    FailedToSerializeRequestBody(String),
31    #[error("EngineClient System Failed after: {0}")]
32    SystemFailed(String),
33}
34
35#[derive(Debug, thiserror::Error)]
36pub enum ExchangeCapabilitiesError {
37    #[error("{0}")]
38    ReqwestError(#[from] reqwest::Error),
39    #[error("{0}")]
40    SerdeJSONError(#[from] serde_json::Error),
41    #[error("{0}")]
42    RPCError(String),
43    #[error("{0}")]
44    ParseIntError(#[from] std::num::ParseIntError),
45}
46
47#[derive(Debug, thiserror::Error)]
48pub enum ForkChoiceUpdatedError {
49    #[error("{0}")]
50    ReqwestError(#[from] reqwest::Error),
51    #[error("{0}")]
52    SerdeJSONError(#[from] serde_json::Error),
53    #[error("{0}")]
54    RPCError(String),
55    #[error("{0}")]
56    ParseIntError(#[from] std::num::ParseIntError),
57    #[error("{0}")]
58    ConversionError(String),
59}
60
61#[derive(Debug, thiserror::Error)]
62pub enum GetPayloadError {
63    #[error("{0}")]
64    ReqwestError(#[from] reqwest::Error),
65    #[error("{0}")]
66    SerdeJSONError(#[from] serde_json::Error),
67    #[error("{0}")]
68    RPCError(String),
69    #[error("{0}")]
70    ParseIntError(#[from] std::num::ParseIntError),
71}
72
73#[derive(Debug, thiserror::Error)]
74pub enum NewPayloadError {
75    #[error("{0}")]
76    ReqwestError(#[from] reqwest::Error),
77    #[error("{0}")]
78    SerdeJSONError(#[from] serde_json::Error),
79    #[error("{0}")]
80    RPCError(String),
81    #[error("{0}")]
82    ParseIntError(#[from] std::num::ParseIntError),
83}