diff --git a/CHANGELOG.md b/CHANGELOG.md index a6976186c..6ebd13efb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,9 @@ `HandleBuffer::handles` and `ProtocolsPerHandle::protocols` methods have been deprecated. - Removed `'boot` lifetime from the `Output` protocol. +- The generic type `Data` of `uefi::Error` doesn't need to be + `Display` to be compatible with `core::error::Error`. Note that the error + Trait requires the `unstable` feature. ## uefi-macros - [Unreleased] diff --git a/uefi/src/result/error.rs b/uefi/src/result/error.rs index 26634c1f6..835676b5a 100644 --- a/uefi/src/result/error.rs +++ b/uefi/src/result/error.rs @@ -1,8 +1,11 @@ +//! Module for UEFI-specific error encodings. See [`Error`]. + use super::Status; use core::fmt::{Debug, Display}; -/// Errors emitted from UEFI entry point must propagate erronerous UEFI statuses, -/// and may optionally propagate additional entry point-specific data. +/// An UEFI-related error with optionally additional payload data. The error +/// kind is encoded in the `status` field (see [`Status`]). Additional payload +/// may be inside the `data` field. #[derive(Debug, PartialEq, Eq)] pub struct Error { status: Status, @@ -40,11 +43,11 @@ impl From for Error<()> { } } -impl Display for Error { +impl Display for Error { fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { - write!(f, "UEFI Error {}: {}", self.status(), self.data()) + write!(f, "UEFI Error {}: {:?}", self.status(), self.data()) } } #[cfg(feature = "unstable")] -impl core::error::Error for Error {} +impl core::error::Error for Error {}