Implement std::error::Error for error::Transport (#299)

Close #294
This commit is contained in:
Martin Algesten
2021-01-09 18:56:20 +01:00
committed by GitHub
parent d0bd2d5ea9
commit c24b250c80

View File

@@ -142,6 +142,15 @@ impl error::Error for Error {
}
}
impl error::Error for Transport {
fn source(&self) -> Option<&(dyn error::Error + 'static)> {
match &self.source {
Some(s) => Some(s.as_ref()),
None => None,
}
}
}
impl Error {
pub(crate) fn new(kind: ErrorKind, message: Option<String>) -> Self {
Error::Transport(Transport {