diff --git a/src/error.rs b/src/error.rs index 7206df3..04e909a 100644 --- a/src/error.rs +++ b/src/error.rs @@ -177,12 +177,17 @@ where E: Into>, { fn to_lua_err(self) -> Error { - #[derive(Debug)] struct WrapError(Box); + impl fmt::Debug for WrapError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(&self.0, f) + } + } + impl fmt::Display for WrapError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - self.0.fmt(f) + fmt::Display::fmt(&self.0, f) } } @@ -190,6 +195,10 @@ where fn description(&self) -> &str { self.0.description() } + + fn cause(&self) -> Option<&StdError> { + self.0.cause() + } } Error::external(WrapError(self.into()))