Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 905c176

Browse files
Merge pull request #693 from phip1611/error-display
error: enable core::error::Error for all error payloads
2 parents cf005f5 + d647d46 commit 905c176

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

‎CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
`HandleBuffer::handles` and `ProtocolsPerHandle::protocols` methods have been
2222
deprecated.
2323
- Removed `'boot` lifetime from the `Output` protocol.
24+
- The generic type `Data` of `uefi::Error<Data: Debug>` doesn't need to be
25+
`Display` to be compatible with `core::error::Error`. Note that the error
26+
Trait requires the `unstable` feature.
2427

2528
## uefi-macros - [Unreleased]
2629

‎uefi/src/result/error.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
//! Module for UEFI-specific error encodings. See [`Error`].
2+
13
use super::Status;
24
use core::fmt::{Debug, Display};
35

4-
/// Errors emitted from UEFI entry point must propagate erronerous UEFI statuses,
5-
/// and may optionally propagate additional entry point-specific data.
6+
/// An UEFI-related error with optionally additional payload data. The error
7+
/// kind is encoded in the `status` field (see [`Status`]). Additional payload
8+
/// may be inside the `data` field.
69
#[derive(Debug, PartialEq, Eq)]
710
pub struct Error<Data: Debug = ()> {
811
status: Status,
@@ -40,11 +43,11 @@ impl From<Status> for Error<()> {
4043
}
4144
}
4245

43-
impl<Data: Debug + Display> Display for Error<Data> {
46+
impl<Data: Debug> Display for Error<Data> {
4447
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
45-
write!(f, "UEFI Error {}: {}", self.status(), self.data())
48+
write!(f, "UEFI Error {}: {:?}", self.status(), self.data())
4649
}
4750
}
4851

4952
#[cfg(feature = "unstable")]
50-
impl<Data: Debug + Display> core::error::Error for Error<Data> {}
53+
impl<Data: Debug> core::error::Error for Error<Data> {}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /