chore(etherscan): add cloudflare captcha error (#2116)

This commit is contained in:
Matthias Seitz 2023-02-06 02:32:55 +01:00 committed by GitHub
parent 2fce943274
commit 56cc3e674a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 1 deletions

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
//! 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 errors::EtherscanError;
use ethers_core::{
@ -209,6 +209,8 @@ impl Client {
error!(target: "etherscan", ?res, "Failed to deserialize response: {}", err);
if is_blocked_by_cloudflare_response(res) {
EtherscanError::BlockedByCloudflare
} else if is_cloudflare_security_challenge(res) {
EtherscanError::CloudFlareSecurityChallenge
} else {
EtherscanError::Serde(err)
}