blob: 6c8acd66d6aee451fc3e62fab67d65615892fc16 (
plain)
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
|
use std::io::Error as IoError;
use hyper::Error as HttpError;
use hyper::status::StatusCode;
use rustc_serialize::json::{DecoderError,EncoderError,ParserError};
#[derive(Debug)]
pub enum Error {
Decoding(DecoderError),
Encoding(EncoderError),
Parse(ParserError),
Http(HttpError),
IO(IoError),
Fault { code: StatusCode, message: String }
}
impl From<ParserError> for Error {
fn from(error: ParserError) -> Error {
Error::Parse(error)
}
}
impl From<DecoderError> for Error {
fn from(error: DecoderError) -> Error {
Error::Decoding(error)
}
}
impl From<EncoderError> for Error {
fn from(error: EncoderError) -> Error {
Error::Encoding(error)
}
}
impl From<HttpError> for Error {
fn from(error: HttpError) -> Error {
Error::Http(error)
}
}
impl From<IoError> for Error {
fn from(error: IoError) -> Error {
Error::IO(error)
}
}
|