Skip to main content

circles_rpc/
error.rs

1use alloy_provider::transport::TransportError;
2use thiserror::Error;
3
4/// Result alias for the Circles RPC crate.
5pub type Result<T> = std::result::Result<T, CirclesRpcError>;
6
7/// Top-level error type for Circles RPC operations.
8#[derive(Debug, Error)]
9pub enum CirclesRpcError {
10    /// Underlying provider/transport error.
11    #[error(transparent)]
12    Transport(#[from] TransportError),
13    /// (De)serialization issues.
14    #[error(transparent)]
15    Serde(#[from] serde_json::Error),
16    /// Unexpected or malformed response payload.
17    #[error("invalid response: {message}")]
18    InvalidResponse { message: String },
19    /// WebSocket subscription closed unexpectedly.
20    #[error("subscription closed")]
21    SubscriptionClosed,
22}