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
32
33
34
35
36
37
38
39
40
41
use super::*;
#[derive(Debug)]
pub enum FetchError {
Http(hyper::Error),
Json(serde_json::Error),
}
impl From<hyper::Error> for FetchError {
fn from(err: hyper::Error) -> FetchError {
FetchError::Http(err)
}
}
impl From<serde_json::Error> for FetchError {
fn from(err: serde_json::Error) -> FetchError {
FetchError::Json(err)
}
}
struct ApiError {
code: i16,
message: &'static str
}
#[derive(Debug, Deserialize, PartialEq)]
pub enum FactomError {
ParseError,
InvalidRequest,
InvalidParams,
InternalError,
MethodNotFound,
RepeatedCommit,
UndefinedError
}