From d5ee82d329eee1127f335190f4ca87f744aa310b Mon Sep 17 00:00:00 2001 From: dickens7 Date: Wed, 17 Jul 2024 22:24:31 +0800 Subject: [PATCH] fix: handler mode write error --- server/server.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/server/server.go b/server/server.go index 24d2f149..ae2093ce 100644 --- a/server/server.go +++ b/server/server.go @@ -584,7 +584,12 @@ func (s *Server) processOneRequest(ctx *share.Context, req *protocol.Message, co sctx := NewContext(ctx, conn, req, s.AsyncWrite) err := handler(sctx) if err != nil { - log.Errorf("[handler internal error]: servicepath: %s, servicemethod, err: %v", req.ServicePath, req.ServiceMethod, err) + if s.HandleServiceError != nil { + s.HandleServiceError(err) + } else { + log.Errorf("[handler internal error]: servicepath: %s, servicemethod, err: %v", req.ServicePath, req.ServiceMethod, err) + } + sctx.WriteError(err) } return