handle additional error wrapping

This commit is contained in:
David Pedersen
2023-03-24 15:36:36 +01:00
parent 91bebd8da9
commit 7dece69cc6
3 changed files with 9 additions and 2 deletions
+7
View File
@@ -16,10 +16,17 @@ impl FailedToBufferBody {
where
E: Into<BoxError>,
{
// two layers of boxes where because `with_limited_body`
// wraps the `http_body_util::Limited` in a `axum_core::Body`
// which also wraps the error type
let box_error = match err.into().downcast::<Error>() {
Ok(err) => err.into_inner(),
Err(err) => err,
};
let box_error = match box_error.downcast::<Error>() {
Ok(err) => err.into_inner(),
Err(err) => err,
};
match box_error.downcast::<http_body_util::LengthLimitError>() {
Ok(err) => Self::LengthLimitError(LengthLimitError::from_err(err)),
Err(err) => Self::UnknownBodyError(UnknownBodyError::from_err(err)),