1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-28 01:52:57 +01:00

render error message as body

This commit is contained in:
Nikolay Kim 2018-10-30 11:53:48 -07:00
parent 79bcbb8a10
commit da82e24954

View File

@ -57,12 +57,16 @@ where
fn call(&mut self, req: Self::Request) -> Self::Future { fn call(&mut self, req: Self::Request) -> Self::Future {
match req { match req {
Ok(r) => Either::A(ok(r)), Ok(r) => Either::A(ok(r)),
Err((e, framed)) => Either::B(SendErrorFut { Err((e, framed)) => {
framed: Some(framed), let mut resp = e.error_response();
res: Some(Message::Item(e.response_with_message())), resp.set_body(format!("{}", e));
err: Some(e), Either::B(SendErrorFut {
_t: PhantomData, framed: Some(framed),
}), res: Some(resp.into()),
err: Some(e),
_t: PhantomData,
})
}
} }
} }
} }