1extern crate memcache;
2
3use std::error;
4use std::error::Error as _StdError;
5use std::fmt;
6
7#[derive(Debug)]
9pub enum Error {
10 Other(memcache::MemcacheError),
12}
13
14impl fmt::Display for Error {
15 fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
16 match self.cause() {
17 Some(cause) => write!(fmt, "{}: {}", self.description(), cause),
18 None => write!(fmt, "{}", self.description()),
19 }
20 }
21}
22
23impl error::Error for Error {
24 fn description(&self) -> &str {
25 match *self {
26 Error::Other(ref err) => err.description(),
27 }
28 }
29
30 fn cause(&self) -> Option<&error::Error> {
31 match *self {
32 Error::Other(ref err) => err.cause(),
33 }
34 }
35}