foundry_wallets/wallet_browser/
error.rs

1use alloy_signer::Error as SignerError;
2
3#[derive(Debug, thiserror::Error)]
4pub enum BrowserWalletError {
5    #[error("{operation} request timed out")]
6    Timeout { operation: &'static str },
7
8    #[error("{operation} rejected: {reason}")]
9    Rejected { operation: &'static str, reason: String },
10
11    #[error("Wallet not connected")]
12    NotConnected,
13
14    #[error("Server error: {0}")]
15    ServerError(String),
16}
17
18impl From<BrowserWalletError> for SignerError {
19    fn from(err: BrowserWalletError) -> Self {
20        Self::other(err)
21    }
22}
23
24impl From<SignerError> for BrowserWalletError {
25    fn from(err: SignerError) -> Self {
26        Self::ServerError(err.to_string())
27    }
28}