aboutsummaryrefslogtreecommitdiff
path: root/src/error.rs
blob: fd717638f9b4cb1d0c4700de9dc53b0b61eefb8c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use err_derive::Error;
use std::io;

#[derive(Debug, Error)]
pub enum Error {
	#[error(display = "IO error: {}", _0)]
	Io(#[error(source)] io::Error),

	#[error(display = "Hyper error: {}", _0)]
	Hyper(#[error(source)] hyper::Error),

	#[error(display = "HTTP error: {}", _0)]
	HTTP(#[error(source)] http::Error),

	#[error(display = "Messagepack encode error: {}", _0)]
	RMPEncode(#[error(source)] rmp_serde::encode::Error),
	#[error(display = "Messagepack decode error: {}", _0)]
	RMPDecode(#[error(source)] rmp_serde::decode::Error),

	#[error(display = "TOML decode error: {}", _0)]
	TomlDecode(#[error(source)] toml::de::Error),

	#[error(display = "Timeout: {}", _0)]
	RPCTimeout(#[error(source)] tokio::time::Elapsed),

	#[error(display = "RPC error: {}", _0)]
	RPCError(String),

	#[error(display = "{}", _0)]
	Message(String),
}