Add Diagnostic::caused_by()

Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
This commit is contained in:
Matthias Beyer 2022-04-28 12:46:50 +02:00
parent d6afb5061d
commit 29aead4a94
1 changed files with 5 additions and 0 deletions

View File

@ -59,6 +59,11 @@ pub trait Diagnostic: std::error::Error {
fn related<'a>(&'a self) -> Option<Box<dyn Iterator<Item = &'a dyn Diagnostic> + 'a>> {
None
}
/// The cause of the error.
fn caused_by(&self) -> Option<&dyn Diagnostic> {
None
}
}
impl std::error::Error for Box<dyn Diagnostic> {