From 51a9f78625d9e31afb8f54dedb13b798eb0ead3f Mon Sep 17 00:00:00 2001 From: SamrutGadde Date: Wed, 1 May 2024 19:09:00 -0500 Subject: [PATCH] hypervisor: aarch64: Use thiserror for errors Updated error enums in hypervisor under aarch64 to use thiserror crate Signed-off-by: SamrutGadde --- hypervisor/src/arch/aarch64/gic.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hypervisor/src/arch/aarch64/gic.rs b/hypervisor/src/arch/aarch64/gic.rs index c18fc2c5c..ecead2dd8 100644 --- a/hypervisor/src/arch/aarch64/gic.rs +++ b/hypervisor/src/arch/aarch64/gic.rs @@ -5,15 +5,19 @@ use crate::{CpuState, GicState, HypervisorDeviceError, HypervisorVmError}; use std::any::Any; use std::result; +use thiserror::Error; /// Errors thrown while setting up the VGIC. -#[derive(Debug)] +#[derive(Debug, Error)] pub enum Error { /// Error while calling KVM ioctl for setting up the global interrupt controller. + #[error("Failed creating GIC device: {0}")] CreateGic(HypervisorVmError), /// Error while setting device attributes for the GIC. + #[error("Failed setting device attributes for the GIC: {0}")] SetDeviceAttribute(HypervisorDeviceError), /// Error while getting device attributes for the GIC. + #[error("Failed getting device attributes for the GIC: {0}")] GetDeviceAttribute(HypervisorDeviceError), } pub type Result = result::Result;