Add Error::source implementation

Fixes #2
This commit is contained in:
Bilal Elmoussaoui 2024-08-09 14:39:30 +02:00 committed by Sandro Bonazzola
parent d4c982399d
commit 23a1d7f163
1 changed files with 11 additions and 1 deletions

View File

@ -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)]