@@ -10,6 +10,8 @@ pub use alloy::rpc::types::{
1010pub use alloy_primitives:: { Address , BlockHash , BlockNumber , Bytes , TxHash , U128 , U256 , U64 , U8 } ;
1111use serde:: { Deserialize , Serialize } ;
1212use std:: collections:: { HashMap , HashSet } ;
13+ use std:: error:: Error ;
14+ use std:: fmt;
1315
1416/// Subscription kind. Pulled directly from alloy (https://github.com/alloy-rs/alloy).
1517/// Why? Because alloy is not yet 1.0 and the types in this interface must be stable.
@@ -130,6 +132,24 @@ pub enum EthError {
130132 RpcMalformedResponse ,
131133}
132134
135+ impl fmt:: Display for EthError {
136+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
137+ match self {
138+ EthError :: RpcError ( e) => write ! ( f, "RPC error: {:?}" , e) ,
139+ EthError :: MalformedRequest => write ! ( f, "Malformed request" ) ,
140+ EthError :: NoRpcForChain => write ! ( f, "No RPC provider for chain" ) ,
141+ EthError :: SubscriptionClosed ( id) => write ! ( f, "Subscription {} closed" , id) ,
142+ EthError :: InvalidMethod ( m) => write ! ( f, "Invalid method: {}" , m) ,
143+ EthError :: InvalidParams => write ! ( f, "Invalid parameters" ) ,
144+ EthError :: PermissionDenied => write ! ( f, "Permission denied" ) ,
145+ EthError :: RpcTimeout => write ! ( f, "RPC request timed out" ) ,
146+ EthError :: RpcMalformedResponse => write ! ( f, "RPC returned malformed response" ) ,
147+ }
148+ }
149+ }
150+
151+ impl Error for EthError { }
152+
133153/// The action type used for configuring eth:distro:sys. Only processes which have the "root"
134154/// [`crate::Capability`] from eth:distro:sys can successfully send this action.
135155#[ derive( Clone , Debug , Serialize , Deserialize ) ]
0 commit comments