From 29aead4a94a14b9a236d7268e2da2ff018a4a69a Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Thu, 28 Apr 2022 12:46:50 +0200 Subject: [PATCH] Add Diagnostic::caused_by() Signed-off-by: Matthias Beyer --- src/protocol.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/protocol.rs b/src/protocol.rs index 2a6545a..2493346 100644 --- a/src/protocol.rs +++ b/src/protocol.rs @@ -59,6 +59,11 @@ pub trait Diagnostic: std::error::Error { fn related<'a>(&'a self) -> Option + 'a>> { None } + + /// The cause of the error. + fn caused_by(&self) -> Option<&dyn Diagnostic> { + None + } } impl std::error::Error for Box {