1use thiserror::Error;
3use reqwest::Error as ReqwestError;
4use serde_json::Error as SerdeJsonError;
5use signer_core::SignerError;
6
7#[derive(Error, Debug)]
9pub enum RemoteError {
10 #[error("IO error: {0}")]
12 Io(#[from] std::io::Error),
13
14 #[error("JSON error: {source}. Reason: {reason}. Input: {input}")]
16 Json {
17 #[source]
18 source: SerdeJsonError,
19 reason: String,
20 input: String,
21 },
22
23 #[error("Network error: {0}")]
25 Network(#[from] ReqwestError),
26
27 #[error("Signer error: {0}")]
29 Signer(#[from] SignerError),
30
31 #[error("Invalid configuration: {0}")]
33 Config(String),
34
35 #[error("Internal error: {0}")]
37 Internal(String),
38
39 #[error("Network connection error: {0}")]
41 NetworkError(String),
42
43 #[error("Invalid operation: {0}")]
45 InvalidOperation(String),
46
47 #[error("Serialization error: {0}")]
49 SerializationError(String),
50}
51
52pub type RemoteResult<T> = std::result::Result<T, RemoteError>;