From 178d2e846da91c4d895512dd986ace200b4b10e5 Mon Sep 17 00:00:00 2001 From: Nikolay Kim Date: Fri, 13 Oct 2017 18:54:02 -0700 Subject: [PATCH] do not use try_trait in main --- src/main.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main.rs b/src/main.rs index 538961b6a..ef35feae7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -61,10 +61,16 @@ impl Route for MyWS { fn request(req: HttpRequest, payload: Payload, ctx: &mut HttpContext) -> Reply { - let resp = ws::handshake(&req)?; - ctx.start(resp); - ctx.add_stream(ws::WsStream::new(payload)); - Reply::stream(MyWS{}) + match ws::handshake(&req) { + Ok(resp) => { + ctx.start(resp); + ctx.add_stream(ws::WsStream::new(payload)); + Reply::stream(MyWS{}) + } + Err(err) => { + Reply::reply(err) + } + } } }