diff options
author | Till Hoeppner | 2015-07-28 00:35:57 +0200 |
---|---|---|
committer | Till Hoeppner | 2015-07-28 00:35:57 +0200 |
commit | 01703f2dcd807f58c03a83bf1d3fa52e8023a0ad (patch) | |
tree | 8d6b48c48481ce6b824b517fd29182494e61a709 /src/lib.rs | |
parent | 2b5c034f133fe55aaf9e5d69c98cafcfee139a11 (diff) | |
download | ilc-01703f2dcd807f58c03a83bf1d3fa52e8023a0ad.tar.gz ilc-01703f2dcd807f58c03a83bf1d3fa52e8023a0ad.tar.xz ilc-01703f2dcd807f58c03a83bf1d3fa52e8023a0ad.zip |
Improved error reporting
Diffstat (limited to 'src/lib.rs')
-rw-r--r-- | src/lib.rs | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -41,6 +41,8 @@ pub enum IlcError { Chrono(ParseError), BincodeDecode, BincodeEncode, + MsgpackEncode(msgpack::encode::serialize::Error), + MsgpackDecode(msgpack::decode::serialize::Error), Io(io::Error) } @@ -58,13 +60,22 @@ impl Error for IlcError { &Chrono(_) => "error while parsing time strings", &BincodeDecode => "error while decoding from binary", &BincodeEncode => "error while encoding to binary", + &MsgpackDecode(_) => "error while decoding from msgpack", + &MsgpackEncode(_) => "error while encoding to msgpack", &Io(_) => "error during input/output" } } fn cause(&self) -> Option<&Error> { + use IlcError::*; match self { - _ => None + &Parse(ref _e) => None, + &Chrono(ref e) => Some(e), + &BincodeDecode => None, + &BincodeEncode => None, + &MsgpackDecode(ref e) => Some(e), + &MsgpackEncode(ref e) => Some(e), + &Io(ref e) => Some(e) } } } |