use thiserror::Error;
use reqwest::Error as ReqwestError;
use serde_json::Error as SerdeJsonError;
use signer_core::SignerError;
#[derive(Error, Debug)]
pub enum RemoteError {
#[error("IO error: {0}")]
Io(#[from] std::io::Error),
#[error("JSON error: {source}. Reason: {reason}. Input: {input}")]
Json {
#[source]
source: SerdeJsonError,
reason: String,
input: String,
},
#[error("Network error: {0}")]
Network(#[from] ReqwestError),
#[error("Signer error: {0}")]
Signer(#[from] SignerError),
#[error("Invalid configuration: {0}")]
Config(String),
#[error("Internal error: {0}")]
Internal(String),
#[error("Network connection error: {0}")]
NetworkError(String),
#[error("Invalid operation: {0}")]
InvalidOperation(String),
#[error("Serialization error: {0}")]
SerializationError(String),
}
pub type RemoteResult<T> = std::result::Result<T, RemoteError>;