mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-18 10:41:01 +00:00
error: RpcError with custom client error (#694)
* error: `RpcError` with custom client error Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * error: Add `SubscriptionDropped` and panic on param errors Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * Update subxt/src/rpc/rpc_client_t.rs Co-authored-by: James Wilson <james@jsdw.me> * Apply rustfmt Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Co-authored-by: James Wilson <james@jsdw.me>
This commit is contained in:
+10
-3
@@ -102,10 +102,17 @@ impl From<DispatchError> for Error {
|
||||
}
|
||||
|
||||
/// An RPC error. Since we are generic over the RPC client that is used,
|
||||
/// the error is any custom string.
|
||||
/// the error is boxed and could be casted.
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
#[error("RPC error: {0}")]
|
||||
pub struct RpcError(pub String);
|
||||
#[error("RPC error")]
|
||||
pub enum RpcError {
|
||||
// Dev note: We need the error to be safely sent between threads
|
||||
// for `subscribe_to_block_headers_filling_in_gaps` and friends.
|
||||
/// Error related to the RPC client.
|
||||
ClientError(Box<dyn std::error::Error + Send + 'static>),
|
||||
/// The RPC subscription dropped.
|
||||
SubscriptionDropped,
|
||||
}
|
||||
|
||||
/// This is our attempt to decode a runtime DispatchError. We either
|
||||
/// successfully decode it into a [`ModuleError`], or we fail and keep
|
||||
|
||||
Reference in New Issue
Block a user