mirror of
https://github.com/uqbar-dao/nectar.git
synced 2025-01-03 06:11:01 +03:00
eth: return explicit rpc errors to process
This commit is contained in:
parent
4302bf323b
commit
9e200de6c9
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -3074,6 +3074,7 @@ dependencies = [
|
|||||||
"aes-gcm",
|
"aes-gcm",
|
||||||
"alloy-consensus 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
"alloy-consensus 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||||
"alloy-contract",
|
"alloy-contract",
|
||||||
|
"alloy-json-rpc 0.1.0 (git+https://github.com/alloy-rs/alloy?rev=6f8ebb4)",
|
||||||
"alloy-network",
|
"alloy-network",
|
||||||
"alloy-primitives 0.6.4",
|
"alloy-primitives 0.6.4",
|
||||||
"alloy-providers",
|
"alloy-providers",
|
||||||
|
@ -30,6 +30,7 @@ alloy-contract = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
|||||||
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
alloy-consensus = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
||||||
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
alloy-pubsub = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
||||||
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
alloy-rpc-types = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
||||||
|
alloy-json-rpc = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
||||||
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4", features = ["ws"]}
|
alloy-rpc-client = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4", features = ["ws"]}
|
||||||
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
alloy-transport-ws = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
||||||
alloy-providers = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
alloy-providers = { git = "https://github.com/alloy-rs/alloy", rev = "6f8ebb4" }
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
use alloy_json_rpc::RpcError;
|
||||||
use alloy_providers::provider::Provider;
|
use alloy_providers::provider::Provider;
|
||||||
use alloy_pubsub::PubSubFrontend;
|
use alloy_pubsub::PubSubFrontend;
|
||||||
use alloy_rpc_client::ClientBuilder;
|
use alloy_rpc_client::ClientBuilder;
|
||||||
@ -618,6 +619,10 @@ async fn fulfill_request(
|
|||||||
return EthResponse::Response { value };
|
return EthResponse::Response { value };
|
||||||
}
|
}
|
||||||
Err(rpc_error) => {
|
Err(rpc_error) => {
|
||||||
|
// if rpc_error is of type ErrResponse, return to user!
|
||||||
|
if let RpcError::ErrorResp(err) = rpc_error {
|
||||||
|
return EthResponse::Err(EthError::RpcError(err.to_string()));
|
||||||
|
}
|
||||||
verbose_print(
|
verbose_print(
|
||||||
print_tx,
|
print_tx,
|
||||||
&format!(
|
&format!(
|
||||||
|
@ -61,6 +61,8 @@ pub enum EthResponse {
|
|||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
#[derive(Debug, Serialize, Deserialize, PartialEq)]
|
||||||
pub enum EthError {
|
pub enum EthError {
|
||||||
|
/// RPC provider returned an error
|
||||||
|
RpcError(String),
|
||||||
/// provider module cannot parse message
|
/// provider module cannot parse message
|
||||||
MalformedRequest,
|
MalformedRequest,
|
||||||
/// No RPC provider for the chain
|
/// No RPC provider for the chain
|
||||||
|
Loading…
Reference in New Issue
Block a user