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
#[derive(Debug, Fail)]
pub enum RedditError {
#[fail(display = "Requested resource {} was not found", request)]
NotFound {
request: String,
},
#[fail(display = "Requested resource {} is forbidden", request)]
Forbidden {
request: String,
},
#[fail(display = "\nSent request {}, got unexpected reponse {}\n", request, response)]
BadResponse {
request: String,
response: String,
},
#[fail(display = "\nAttempted incorrect request {} got response {}\n", request, response)]
BadRequest {
request: String,
response: String,
},
#[fail(display = "Failed to authorize")]
AuthError,
}
#[derive(Debug, Fail)]
#[fail(display = "Could not parse json {} as {}\n", json, thing_type)]
pub struct ParseError {
pub thing_type: String,
pub json: String,
}