chore(etherscan): add cloudflare captcha error (#2116)
This commit is contained in:
parent
2fce943274
commit
56cc3e674a
File diff suppressed because one or more lines are too long
|
@ -1,6 +1,6 @@
|
||||||
//! Bindings for [etherscan.io web api](https://docs.etherscan.io/)
|
//! Bindings for [etherscan.io web api](https://docs.etherscan.io/)
|
||||||
|
|
||||||
use crate::errors::is_blocked_by_cloudflare_response;
|
use crate::errors::{is_blocked_by_cloudflare_response, is_cloudflare_security_challenge};
|
||||||
use contract::ContractMetadata;
|
use contract::ContractMetadata;
|
||||||
use errors::EtherscanError;
|
use errors::EtherscanError;
|
||||||
use ethers_core::{
|
use ethers_core::{
|
||||||
|
@ -209,6 +209,8 @@ impl Client {
|
||||||
error!(target: "etherscan", ?res, "Failed to deserialize response: {}", err);
|
error!(target: "etherscan", ?res, "Failed to deserialize response: {}", err);
|
||||||
if is_blocked_by_cloudflare_response(res) {
|
if is_blocked_by_cloudflare_response(res) {
|
||||||
EtherscanError::BlockedByCloudflare
|
EtherscanError::BlockedByCloudflare
|
||||||
|
} else if is_cloudflare_security_challenge(res) {
|
||||||
|
EtherscanError::CloudFlareSecurityChallenge
|
||||||
} else {
|
} else {
|
||||||
EtherscanError::Serde(err)
|
EtherscanError::Serde(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue