mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 20:35:41 +00:00
fix: don't wrap rpc error in DisconnectedWillReconnect in reconnecting rpc client (#1904)
* fix: don't wrap rpc err in DisconnectedWillRecon * add clarifying comment * fix no-std-test build * fix no-std-test build v2
This commit is contained in:
@@ -427,7 +427,13 @@ impl RpcClientT for RpcClient {
|
|||||||
async {
|
async {
|
||||||
self.request(method.to_string(), params)
|
self.request(method.to_string(), params)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| SubxtRpcError::DisconnectedWillReconnect(e.to_string()))
|
.map_err(|e| match e {
|
||||||
|
Error::DisconnectedWillReconnect(e) => {
|
||||||
|
SubxtRpcError::DisconnectedWillReconnect(e.to_string())
|
||||||
|
}
|
||||||
|
Error::Dropped => SubxtRpcError::ClientError(Box::new(e)),
|
||||||
|
Error::RpcError(e) => SubxtRpcError::ClientError(Box::new(e)),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
.boxed()
|
.boxed()
|
||||||
}
|
}
|
||||||
@@ -449,7 +455,11 @@ impl RpcClientT for RpcClient {
|
|||||||
SubscriptionId::Str(s) => s.to_string(),
|
SubscriptionId::Str(s) => s.to_string(),
|
||||||
};
|
};
|
||||||
let stream = sub
|
let stream = sub
|
||||||
.map_err(|e| SubxtRpcError::DisconnectedWillReconnect(e.to_string()))
|
// NOTE: The stream emits only one error `DisconnectWillReconnect if the connection was lost
|
||||||
|
// and safe to wrap it in a `SubxtRpcError::DisconnectWillReconnect` here
|
||||||
|
.map_err(|e: DisconnectedWillReconnect| {
|
||||||
|
SubxtRpcError::DisconnectedWillReconnect(e.to_string())
|
||||||
|
})
|
||||||
.boxed();
|
.boxed();
|
||||||
|
|
||||||
Ok(RawRpcSubscription {
|
Ok(RawRpcSubscription {
|
||||||
|
|||||||
Generated
+76
-1144
File diff suppressed because it is too large
Load Diff
@@ -3,12 +3,11 @@
|
|||||||
// see LICENSE for license details.
|
// see LICENSE for license details.
|
||||||
|
|
||||||
#![allow(internal_features)]
|
#![allow(internal_features)]
|
||||||
#![feature(lang_items, start)]
|
#![feature(lang_items, alloc_error_handler)]
|
||||||
#![feature(alloc_error_handler)]
|
|
||||||
#![no_std]
|
#![no_std]
|
||||||
|
#![no_main]
|
||||||
|
|
||||||
#[start]
|
pub extern "C" fn _start(_argc: isize, _argv: *const *const u8) -> isize {
|
||||||
fn start(_argc: isize, _argv: *const *const u8) -> isize {
|
|
||||||
compile_test();
|
compile_test();
|
||||||
0
|
0
|
||||||
}
|
}
|
||||||
@@ -60,11 +59,10 @@ fn compile_test() {
|
|||||||
|
|
||||||
// Subxt Core compiles:
|
// Subxt Core compiles:
|
||||||
let _era = subxt_core::utils::Era::Immortal;
|
let _era = subxt_core::utils::Era::Immortal;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[subxt_macro::subxt(
|
#[subxt_macro::subxt(
|
||||||
runtime_metadata_path = "../../artifacts/polkadot_metadata_full.scale",
|
runtime_metadata_path = "../../artifacts/polkadot_metadata_full.scale",
|
||||||
crate="::subxt_core"
|
crate = "::subxt_core"
|
||||||
)]
|
)]
|
||||||
pub mod polkadot{}
|
pub mod polkadot {}
|
||||||
|
|||||||
Reference in New Issue
Block a user