diff options
author | softprops <d.tangren@gmail.com> | 2016-01-03 14:35:59 -0500 |
---|---|---|
committer | softprops <d.tangren@gmail.com> | 2016-01-03 14:35:59 -0500 |
commit | f209a359284a912a068188013cb39202a5dfd6e8 (patch) | |
tree | 4c67c9d7ec1668a1c847479b3544366b6b8c639c /src/errors.rs | |
parent | d97ce41bafc0aefc88cb7b2ee905402caec93535 (diff) |
less unwrapping
Diffstat (limited to 'src/errors.rs')
-rw-r--r-- | src/errors.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/errors.rs b/src/errors.rs index 68568c8..6c8acd6 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -1,17 +1,24 @@ use std::io::Error as IoError; use hyper::Error as HttpError; use hyper::status::StatusCode; -use rustc_serialize::json::{DecoderError,EncoderError}; +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) |