diff --git a/grpc.go b/grpc.go index 608be67..97b4241 100644 --- a/grpc.go +++ b/grpc.go @@ -7,7 +7,6 @@ import ( "fmt" "net" "reflect" - "runtime/debug" "sort" "strconv" "strings" @@ -20,7 +19,7 @@ import ( "go.unistack.org/micro/v3/codec" "go.unistack.org/micro/v3/errors" "go.unistack.org/micro/v3/logger" - metadata "go.unistack.org/micro/v3/metadata" + "go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v3/register" "go.unistack.org/micro/v3/server" "golang.org/x/net/netutil" @@ -204,19 +203,6 @@ func (g *Server) handler(srv interface{}, stream grpc.ServerStream) (err error) return status.New(codes.InvalidArgument, err.Error()).Err() } - defer func() { - if r := recover(); r != nil { - g.RLock() - config := g.opts - g.RUnlock() - if config.Logger.V(logger.ErrorLevel) { - config.Logger.Errorf(config.Context, "panic in %s.%s recovered: %v", serviceName, methodName, r) - config.Logger.Error(config.Context, string(debug.Stack())) - } - err = errors.InternalServerError(g.opts.Name, "panic in %s.%s recovered: %v", serviceName, methodName, r) - } - }() - if g.wg != nil { g.wg.Add(1) defer g.wg.Done() diff --git a/subscriber.go b/subscriber.go index 94f11f5..f93121d 100644 --- a/subscriber.go +++ b/subscriber.go @@ -4,12 +4,9 @@ import ( "context" "fmt" "reflect" - "runtime/debug" "strings" "go.unistack.org/micro/v3/broker" - "go.unistack.org/micro/v3/errors" - "go.unistack.org/micro/v3/logger" "go.unistack.org/micro/v3/metadata" "go.unistack.org/micro/v3/register" "go.unistack.org/micro/v3/server" @@ -104,15 +101,6 @@ func newSubscriber(topic string, sub interface{}, opts ...server.SubscriberOptio func (g *Server) createSubHandler(sb *subscriber, opts server.Options) broker.Handler { return func(p broker.Event) (err error) { - defer func() { - if r := recover(); r != nil { - if g.opts.Logger.V(logger.ErrorLevel) { - g.opts.Logger.Error(g.opts.Context, "panic recovered: ", r) - g.opts.Logger.Error(g.opts.Context, string(debug.Stack())) - } - err = errors.InternalServerError(g.opts.Name+".subscriber", "panic recovered: %v", r) - } - }() msg := p.Message() // if we don't have headers, create empty map