mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-19 00:41:03 +00:00
lightclient: Add light client Error
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -8,6 +8,9 @@ mod dispatch_error;
|
|||||||
|
|
||||||
use core::fmt::Debug;
|
use core::fmt::Debug;
|
||||||
|
|
||||||
|
#[cfg(feature = "experimental-light-client")]
|
||||||
|
pub use crate::rpc::LightClientError;
|
||||||
|
|
||||||
// Re-export dispatch error types:
|
// Re-export dispatch error types:
|
||||||
pub use dispatch_error::{
|
pub use dispatch_error::{
|
||||||
ArithmeticError, DispatchError, ModuleError, RawModuleError, TokenError, TransactionalError,
|
ArithmeticError, DispatchError, ModuleError, RawModuleError, TokenError, TransactionalError,
|
||||||
@@ -63,6 +66,10 @@ pub enum Error {
|
|||||||
/// The bytes representing an error that we were unable to decode.
|
/// The bytes representing an error that we were unable to decode.
|
||||||
#[error("An error occurred but it could not be decoded: {0:?}")]
|
#[error("An error occurred but it could not be decoded: {0:?}")]
|
||||||
Unknown(Vec<u8>),
|
Unknown(Vec<u8>),
|
||||||
|
/// Light client error.
|
||||||
|
#[cfg(feature = "experimental-light-client")]
|
||||||
|
#[error("An error occurred but it could not be decoded: {0:?}")]
|
||||||
|
LightClient(#[from] LightClientError),
|
||||||
/// Other error.
|
/// Other error.
|
||||||
#[error("Other error: {0}")]
|
#[error("Other error: {0}")]
|
||||||
Other(String),
|
Other(String),
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
mod background;
|
||||||
|
mod client;
|
||||||
|
|
||||||
|
pub use client::LightClient;
|
||||||
|
|
||||||
|
/// Light client error.
|
||||||
|
#[derive(Debug, thiserror::Error)]
|
||||||
|
pub enum LightClientError {
|
||||||
|
/// Error encountered while adding the chain to the light-client.
|
||||||
|
#[error("Failed to add the chain to the light client: {0}")]
|
||||||
|
AddChainError(String),
|
||||||
|
/// The background task is closed.
|
||||||
|
#[error("Failed to communicate with the background task.")]
|
||||||
|
BackgroundClosed,
|
||||||
|
/// Invalid RPC parameters cannot be serialized as JSON string.
|
||||||
|
#[error("RPC parameters cannot be serialized as JSON string.")]
|
||||||
|
InvalidParams,
|
||||||
|
/// Error originated while trying to submit a RPC request.
|
||||||
|
#[error("RPC request cannot be sent: {0}")]
|
||||||
|
Request(String),
|
||||||
|
/// The provided URL scheme is invalid.
|
||||||
|
///
|
||||||
|
/// Supported versions: WS, WSS.
|
||||||
|
#[error("The provided URL scheme is invalid.")]
|
||||||
|
InvalidScheme,
|
||||||
|
/// The provided URL is invalid.
|
||||||
|
#[error("The provided URL scheme is invalid.")]
|
||||||
|
InvalidUrl,
|
||||||
|
/// Handshake error while connecting to a node.
|
||||||
|
#[error("WS handshake failed")]
|
||||||
|
Handshake,
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user