mirror of
https://github.com/tokio-rs/axum.git
synced 2026-09-08 00:00:24 +02:00
handle additional error wrapping
This commit is contained in:
@@ -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)),
|
||||
|
||||
Reference in New Issue
Block a user