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

Close #294
This commit is contained in:
Martin Algesten authored and GitHub committed 2021-01-09 09:56:20 -08:00
1 parent d0bd2d5ea9
commit c24b250c80
1 file changed
+9
+9
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 { impl Error {
pub(crate) fn new(kind: ErrorKind, message: Option<String>) -> Self { pub(crate) fn new(kind: ErrorKind, message: Option<String>) -> Self {
Error::Transport(Transport { Error::Transport(Transport {