hypervisor: aarch64: Use thiserror for errors

Updated error enums in hypervisor under aarch64 to use thiserror crate

Signed-off-by: SamrutGadde <samrut.gadde@gmail.com>
This commit is contained in:
SamrutGadde 2024-05-01 19:09:00 -05:00 committed by Bo Chen
parent 89b429c768
commit 51a9f78625

View File

@ -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<T> = result::Result<T, Error>;