From 23a1d7f16316da59c785798ef7bf5fcf86e247af Mon Sep 17 00:00:00 2001 From: Bilal Elmoussaoui Date: Fri, 9 Aug 2024 14:39:30 +0200 Subject: [PATCH] Add Error::source implementation Fixes #2 --- src/main.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 3c21969..b3a3f41 100644 --- a/src/main.rs +++ b/src/main.rs @@ -58,7 +58,17 @@ impl fmt::Display for Error { } } -impl error::Error for Error {} +impl error::Error for Error { + fn source(&self) -> Option<&(dyn error::Error + 'static)> { + match self { + Error::Bootconfig(e) => Some(e), + Error::DiskImage(e) => Some(e), + Error::Partitions(e) => Some(e), + Error::TransformSparse(e) => Some(e), + Error::Uboot(e) => Some(e), + Error::Vbmeta(e) => Some(e), } + } +} #[derive(Parser)] #[command(author, version, about, long_about = None)]