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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#![feature(try_trait)]
#[macro_use]
extern crate failure;
extern crate serde_json;
#[macro_use]
extern crate err_convert_macro;
extern crate cxmr_currency;
extern crate cxmr_exchanges;
extern crate cxmr_http_client;
#[derive(Debug, Fail)]
pub enum Error {
#[fail(display = "option none")]
OptionNone,
#[fail(display = "currency module error: {}", _0)]
Currency(#[cause] cxmr_currency::Error),
#[fail(display = "parse int error: {:?}", _0)]
ParseInt(#[cause] std::num::ParseIntError),
#[fail(display = "parse float error: {:?}", _0)]
ParseFloat(#[cause] std::num::ParseFloatError),
#[fail(display = "http client error: {:?}", _0)]
Http(#[cause] cxmr_http_client::Error),
#[fail(display = "serde json error: {:?}", _0)]
SerdeJson(#[cause] serde_json::Error),
#[fail(display = "unexpected order type: {}", _0)]
UnexpectedOrderType(String),
#[fail(display = "unexpected order status: {}", _0)]
UnexpectedOrderStatus(String),
#[fail(display = "unexpected order time: {}", _0)]
UnexpectedOrderTime(String),
#[fail(display = "unexpected order side: {}", _0)]
UnexpectedOrderSide(String),
#[fail(display = "unexpected market status: {}", _0)]
UnexpectedMarketStatus(String),
#[fail(display = "unexpected rate limit side: {}", _0)]
UnexpectedRateLimitType(String),
#[fail(display = "unexpected filter type: {}", _0)]
UnexpectedFilterType(String),
#[fail(display = "exchange client for {:?} is not implemented.", _0)]
ExchangeNotSupported(cxmr_exchanges::Exchange),
}
err_converter_no_args!(OptionNone, std::option::NoneError);
err_converter!(ParseInt, std::num::ParseIntError);
err_converter!(ParseFloat, std::num::ParseFloatError);
err_converter!(Http, cxmr_http_client::Error);
err_converter!(SerdeJson, serde_json::Error);
err_converter!(Currency, cxmr_currency::Error);