avail_rust_client/
error.rs1#[derive(thiserror::Error, Debug)]
3pub enum UserError {
4 #[error("{0}")]
6 Decoding(String),
7 #[error("{0}")]
9 ValidationFailed(String),
10 #[error("{0}")]
12 Other(String),
13}
14
15#[derive(thiserror::Error, Debug)]
17pub enum Error {
18 #[error("{0}")]
20 RpcError(avail_rust_core::rpc::Error),
21 #[error("{0}")]
23 User(UserError),
24 #[error("{0}")]
26 Other(String),
27}
28
29impl From<avail_rust_core::rpc::Error> for Error {
30 fn from(value: avail_rust_core::rpc::Error) -> Self {
32 Self::RpcError(value)
33 }
34}
35
36impl From<UserError> for Error {
37 fn from(value: UserError) -> Self {
39 Self::User(value)
40 }
41}
42
43impl From<&str> for Error {
44 fn from(value: &str) -> Self {
46 Self::Other(value.to_owned())
47 }
48}
49
50impl From<codec::Error> for Error {
51 fn from(value: codec::Error) -> Self {
53 Self::Other(value.to_string())
54 }
55}