Skip to content

Commit

Permalink
fix(protocol): implement source/cause for Box<dyn Diagnostic>
Browse files Browse the repository at this point in the history
  • Loading branch information
zkat committed Sep 17, 2021
1 parent 9901030 commit 3e8a27e
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/protocol.rs
Expand Up @@ -52,7 +52,15 @@ pub trait Diagnostic: std::error::Error {
}
}

impl std::error::Error for Box<dyn Diagnostic> {}
impl std::error::Error for Box<dyn Diagnostic> {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
(**self).source()
}

fn cause(&self) -> Option<&dyn std::error::Error> {
self.source()
}
}

impl<T: Diagnostic + Send + Sync + 'static> From<T>
for Box<dyn Diagnostic + Send + Sync + 'static>
Expand Down

0 comments on commit 3e8a27e

Please sign in to comment.