Skip to content

Commit add09b9

Browse files
committed
convert an http_types::Error into an anyhow::Error
1 parent e88d8fc commit add09b9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/error.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ impl Error {
112112
None
113113
}
114114

115+
/// Returns the inner [`anyhow::Error`]
116+
/// Note: This will lose status code information
117+
pub fn into_inner(self) -> anyhow::Error {
118+
self.error
119+
}
120+
115121
/// Attempt to downcast the error object to a concrete type.
116122
pub fn downcast<E>(self) -> std::result::Result<E, Self>
117123
where
@@ -163,7 +169,6 @@ impl<E: Into<anyhow::Error>> From<E> for Error {
163169
Self::new(StatusCode::InternalServerError, error)
164170
}
165171
}
166-
167172
impl AsRef<dyn StdError + Send + Sync> for Error {
168173
fn as_ref(&self) -> &(dyn StdError + Send + Sync + 'static) {
169174
self.error.as_ref()

0 commit comments

Comments
 (0)