From aa66a49925090b58dd1cc45a4c4a2316117c7ea4 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 6 Apr 2018 12:54:22 +0900 Subject: [PATCH] ing --- web/fasthttp/server-handler.go | 1 + web/fasthttp/server.go | 7 +++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/fasthttp/server-handler.go b/web/fasthttp/server-handler.go index 551cbdb..6f3f4d2 100644 --- a/web/fasthttp/server-handler.go +++ b/web/fasthttp/server-handler.go @@ -59,6 +59,7 @@ func (sh *ServerHandlers) Destroy(serverCtx server.ServerCtx) { } func (sh *ServerHandlers) OnError(serverCtx server.ServerCtx, ctx *fasthttp.RequestCtx, status int, reason error) { + ctx.Error(reason.Error(), status) } func (sh *ServerHandlers) RegisterServlet(contextPath string, servlet Servlet) { diff --git a/web/fasthttp/server.go b/web/fasthttp/server.go index 2060f99..d85f4fe 100644 --- a/web/fasthttp/server.go +++ b/web/fasthttp/server.go @@ -135,11 +135,10 @@ func (s *Server) handleServer(listener net.Listener) error { func (s *Server) httpHandler(ctx *fasthttp.RequestCtx) { var ( servlet Servlet - err error ) - if servlet = s.ServerHandler.(ServerHandler).Servlet(s.ctx, ctx); nil == servlet { - s.onError(ctx, fasthttp.StatusNotFound, err) + if servlet = s.ServerHandler.Servlet(s.ctx, ctx); nil == servlet { + s.onError(ctx, fasthttp.StatusNotFound, fmt.Errorf("Not Found")) return } servletCtx := servlet.ServletCtx(s.ctx) @@ -148,5 +147,5 @@ func (s *Server) httpHandler(ctx *fasthttp.RequestCtx) { } func (s *Server) onError(ctx *fasthttp.RequestCtx, status int, reason error) { - s.ServerHandler.(ServerHandler).OnError(s.ctx, ctx, status, reason) + s.ServerHandler.OnError(s.ctx, ctx, status, reason) }