avail_rust_client/
error.rs1use avail_rust_core::ext::codec;
2
3#[derive(Debug)]
4#[repr(u8)]
5pub enum ClientError {
6 #[cfg(feature = "subxt")]
7 Subxt(crate::subxt::Error) = 0,
8 Core(avail_rust_core::Error) = 1,
9 Custom(String) = 2,
10 Codec(codec::Error) = 3,
11 Hex(hex::FromHexError) = 4,
12}
13
14impl From<avail_rust_core::Error> for ClientError {
15 fn from(value: avail_rust_core::Error) -> Self {
16 Self::Core(value)
17 }
18}
19
20impl From<String> for ClientError {
21 fn from(value: String) -> Self {
22 Self::Custom(value)
23 }
24}
25
26impl From<&str> for ClientError {
27 fn from(value: &str) -> Self {
28 Self::Custom(String::from(value))
29 }
30}
31
32impl From<codec::Error> for ClientError {
33 fn from(value: codec::Error) -> Self {
34 Self::Codec(value)
35 }
36}
37
38impl From<hex::FromHexError> for ClientError {
39 fn from(value: hex::FromHexError) -> Self {
40 Self::Hex(value)
41 }
42}
43
44#[cfg(feature = "subxt")]
45impl From<crate::subxt::Error> for ClientError {
46 fn from(value: crate::subxt::Error) -> Self {
47 Self::Subxt(value)
48 }
49}