aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorC. Morgan Hamill <me@cmhamill.org>2015-03-20 14:21:14 +0100
committerC. Morgan Hamill <me@cmhamill.org>2015-03-20 14:21:14 +0100
commit0b098ba55c3cd6e0790a517f0259dd444a067b00 (patch)
treeaa2457d49eb403c2f6a93ddf61a32c1cf5cdd4ca
parent107624c5bb11e6ab8c72d85392f9645efd7c6545 (diff)
downloadmail-0b098ba55c3cd6e0790a517f0259dd444a067b00.tar.gz
Add `cause()` method to `Error` type.
Returns the underlying error type, if any.
-rw-r--r--src/error.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/error.rs b/src/error.rs
index 57d636a..b26a21d 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -26,6 +26,13 @@ impl error::Error for Error {
Error::NotmuchError(ref e) => e.description(),
}
}
+
+ fn cause(&self) -> Option<&error::Error> {
+ match *self {
+ Error::IoError(ref e) => Some(e),
+ Error::NotmuchError(ref e) => Some(e),
+ }
+ }
}
impl error::FromError<io::Error> for Error {