Skip to main content

pop_fork/error/
rpc.rs

1// SPDX-License-Identifier: GPL-3.0
2
3//! RPC client error types.
4
5use thiserror::Error;
6
7/// Errors that can occur when interacting with the RPC client.
8#[derive(Debug, Error)]
9pub enum RpcClientError {
10	/// Failed to connect to the RPC endpoint.
11	#[error("Failed to connect to {endpoint}: {message}")]
12	ConnectionFailed {
13		/// The endpoint URL that failed to connect.
14		endpoint: String,
15		/// The error message describing the failure.
16		message: String,
17	},
18	/// RPC request failed.
19	#[error("RPC request `{method}` failed: {message}")]
20	RequestFailed {
21		/// The RPC method that failed.
22		method: &'static str,
23		/// The error message describing the failure.
24		message: String,
25	},
26	/// RPC request timed out.
27	#[error("RPC request `{method}` timed out")]
28	Timeout {
29		/// The RPC method that timed out.
30		method: &'static str,
31	},
32	/// Invalid response from RPC.
33	#[error("Invalid RPC response: {0}")]
34	InvalidResponse(String),
35	/// Storage key not found (this is different from empty storage).
36	#[error("Required storage key not found: {0}")]
37	StorageNotFound(String),
38	/// Failed to decode metadata from remote chain.
39	#[error("Metadata decoding failed: {0}")]
40	MetadataDecodingFailed(String),
41}