From 24e19787e0712267bb29832c85b37c606f8eed40 Mon Sep 17 00:00:00 2001 From: David Pedersen Date: Tue, 18 Jan 2022 10:35:03 +0100 Subject: [PATCH] feat(error): add `Error::message` --- src/error.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/error.rs b/src/error.rs index e9dc175bdf..265f9172dc 100644 --- a/src/error.rs +++ b/src/error.rs @@ -396,6 +396,11 @@ impl Error { } } + /// The error's standalone message, without the message from the source. + pub fn message(&self) -> impl fmt::Display + '_ { + self.description() + } + fn description(&self) -> &str { match self.inner.kind { Kind::Parse(Parse::Method) => "invalid HTTP method parsed",