Skip to content

Commit 6932896

Browse files
authored
feat(error): add Error::message (#2737)
This adds Error::message which returns the message that is unique to the error, without the message from the source. That way users can create a newtype around hyper::Error and use this in the Display impl to work around #2732. Closes #2732
1 parent dcdd6d1 commit 6932896

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/error.rs

+5
Original file line numberDiff line numberDiff line change
@@ -396,6 +396,11 @@ impl Error {
396396
}
397397
}
398398

399+
/// The error's standalone message, without the message from the source.
400+
pub fn message(&self) -> impl fmt::Display + '_ {
401+
self.description()
402+
}
403+
399404
fn description(&self) -> &str {
400405
match self.inner.kind {
401406
Kind::Parse(Parse::Method) => "invalid HTTP method parsed",

0 commit comments

Comments
 (0)