@@ -25,6 +25,7 @@ import (
2525)
2626
2727import (
28+ "github.com/dubbogo/gost/log/logger"
2829 "github.com/dubbogo/grpc-go"
2930 "github.com/dubbogo/grpc-go/metadata"
3031 "github.com/dubbogo/grpc-go/status"
@@ -64,13 +65,13 @@ func (t *tripleCompatInterceptor) compatUnaryServerInterceptor(ctx context.Conte
6465 }
6566 dubbo3RespRaw , err := handler (ctx , typed .Any ())
6667 if dubbo3RespRaw == nil && err == nil {
67- // This is going to panic during serialization. Debugging is much easier
68- // if we panic here instead, so we can include the procedure name.
69- panic (fmt .Sprintf ("%s returned nil resp and nil error" , t .procedure )) //nolint: forbidigo
68+ logger .Errorf ("Procedure %s unexpectedly returned both nil response and nil error, which should not happen" , t .procedure )
69+ return nil , errorf (CodeInternal , "Procedure %s unexpectedly returned both nil response and nil error, which should not happen" , t .procedure )
7070 }
7171 dubbo3Resp , ok := dubbo3RespRaw .(* dubbo_protocol.RPCResult )
7272 if ! ok {
73- panic (fmt .Sprintf ("%+v is not of type *RPCResult" , dubbo3RespRaw ))
73+ logger .Errorf ("Procedure %s returned an unexpected response type. Expected *dubbo_protocol.RPCResult, but got %T" , t .procedure , dubbo3RespRaw )
74+ return nil , errorf (CodeInternal , "Procedure %s returned an unexpected response type. Expected *dubbo_protocol.RPCResult, but got %T" , t .procedure , dubbo3RespRaw )
7475 }
7576 dubbo3Err , ok := compatError (err )
7677 if ok {
0 commit comments