From da82e249547530a809fe5b3c3c4252d4abbbfef5 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Tue, 30 Oct 2018 11:53:48 -0700 Subject: [PATCH] render error message as body --- src/service.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/service.rs b/src/service.rs index 5879b3881..c76530320 100644 --- a/src/service.rs +++ b/src/service.rs @@ -57,12 +57,16 @@ where fn call(&mut self, req: Self::Request) -> Self::Future { match req { Ok(r) => Either::A(ok(r)), - Err((e, framed)) => Either::B(SendErrorFut { - framed: Some(framed), - res: Some(Message::Item(e.response_with_message())), - err: Some(e), - _t: PhantomData, - }), + Err((e, framed)) => { + let mut resp = e.error_response(); + resp.set_body(format!("{}", e)); + Either::B(SendErrorFut { + framed: Some(framed), + res: Some(resp.into()), + err: Some(e), + _t: PhantomData, + }) + } } } }