mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-30 10:10:44 +02:00
Use context to log "panic recovered" errors in grpc-server plugin (#2278)
This commit is contained in:
parent
cb3db7dd83
commit
b8fbe87e1f
@ -398,10 +398,7 @@ func (g *grpcServer) processRequest(stream grpc.ServerStream, service *service,
|
||||
fn := func(ctx context.Context, req server.Request, rsp interface{}) (err error) {
|
||||
defer func() {
|
||||
if r := recover(); r != nil {
|
||||
if logger.V(logger.ErrorLevel, logger.DefaultLogger) {
|
||||
logger.Error("panic recovered: ", r)
|
||||
logger.Error(string(debug.Stack()))
|
||||
}
|
||||
logger.Extract(ctx).Errorf("panic recovered: %v, stack: %s", r, string(debug.Stack()))
|
||||
err = errors.InternalServerError("go.micro.server", "panic recovered: %v", r)
|
||||
}
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user