misc: arch/riscv64: streamline #[source] and Error

This streamlines the code base to follow best practices for
error handling in Rust: Each error struct implements
std::error::Error (most due via thiserror::Error derive macro)
and sets its source accordingly.

This allows future work that nicely prints the error chains,
for example.

So far, the convention is that each error prints its
sub error as part of its Display::fmt() impl.

Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
On-behalf-of: SAP philipp.schuster@sap.com
This commit is contained in:
Philipp Schuster
2025-05-19 09:49:51 +02:00
committed by Rob Bradford
parent d1a406143d
commit a212343908
17 changed files with 179 additions and 174 deletions
+1 -1
View File
@@ -204,7 +204,7 @@ pub enum Error {
#[cfg(target_arch = "x86_64")]
#[error("Failed to inject NMI")]
NmiError(hypervisor::HypervisorCpuError),
NmiError(#[source] hypervisor::HypervisorCpuError),
}
pub type Result<T> = result::Result<T, Error>;