aboutsummaryrefslogtreecommitdiff
path: root/src/lib.rs
diff options
context:
space:
mode:
authorTill Hoeppner2015-07-28 00:35:57 +0200
committerTill Hoeppner2015-07-28 00:35:57 +0200
commit01703f2dcd807f58c03a83bf1d3fa52e8023a0ad (patch)
tree8d6b48c48481ce6b824b517fd29182494e61a709 /src/lib.rs
parent2b5c034f133fe55aaf9e5d69c98cafcfee139a11 (diff)
downloadilc-01703f2dcd807f58c03a83bf1d3fa52e8023a0ad.tar.gz
ilc-01703f2dcd807f58c03a83bf1d3fa52e8023a0ad.tar.xz
ilc-01703f2dcd807f58c03a83bf1d3fa52e8023a0ad.zip
Improved error reporting
Diffstat (limited to 'src/lib.rs')
-rw-r--r--src/lib.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/lib.rs b/src/lib.rs
index c817e6c..422ca07 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -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)
}
}
}