Skip to content
This repository has been archived by the owner on Oct 19, 2024. It is now read-only.

Commit

Permalink
rename unknown chain error
Browse files Browse the repository at this point in the history
  • Loading branch information
shekhirin committed Oct 24, 2021
1 parent dcb20f7 commit addf907
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions ethers-etherscan/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ use std::env::VarError;

#[derive(Debug, thiserror::Error)]
pub enum EtherscanError {
#[error("unknown chain {0}")]
UnknownChain(Chain),
#[error("chain {0} not supported")]
ChainNotSupported(Chain),
#[error("contract execution call failed: {0}")]
ExecutionFailed(String),
#[error("tx receipt failed")]
Expand Down
6 changes: 3 additions & 3 deletions ethers-etherscan/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl Client {
Url::parse(&format!("https://{}.etherscan.io", chain_name)),
)
}
chain => return Err(EtherscanError::UnknownChain(chain)),
chain => return Err(EtherscanError::ChainNotSupported(chain)),
};

Ok(Self {
Expand Down Expand Up @@ -155,10 +155,10 @@ mod tests {
use ethers_core::types::Chain;

#[test]
fn unknown_chain() {
fn chain_not_supported() {
let err = Client::new_from_env(Chain::XDai).unwrap_err();

assert!(matches!(err, EtherscanError::UnknownChain(_)));
assert!(matches!(err, EtherscanError::ChainNotSupported(_)));
assert_eq!(err.to_string(), "unknown chain XDai");
}
}

0 comments on commit addf907

Please sign in to comment.