hypervisor: emulator: Print out all exception details

Print out all the details from an emulator exception.

As identified by the new beta clippy.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2021-10-19 15:01:42 +01:00
parent 84f0f332b3
commit 7d7577007a

View File

@ -18,7 +18,18 @@ pub struct Exception<T: Debug> {
impl<T: Debug> Display for Exception<T> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "Exception {:?} at IP {:#x}", self.vector, self.ip)
write!(
f,
"Exception {:?} at IP {:#x}{}{}",
self.vector,
self.ip,
self.error
.map(|e| format!(": error {:x}", e))
.unwrap_or_else(|| "".to_owned()),
self.payload
.map(|payload| format!(": payload {:x}", payload))
.unwrap_or_else(|| "".to_owned())
)
}
}