From 0d3d13b7ab00eb07ffe1fb9aabcc097c83a20746 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Thu, 8 Oct 2020 13:42:27 +0300 Subject: [PATCH] add warning when handler returns not *errors.Error or proto.Message error type Signed-off-by: Vasiliy Tolstov --- grpc.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/grpc.go b/grpc.go index 05be06a..eab1b9f 100644 --- a/grpc.go +++ b/grpc.go @@ -476,6 +476,9 @@ func (g *grpcServer) processRequest(stream grpc.ServerStream, service *service, return err } default: + if logger.V(logger.ErrorLevel) { + logger.Warn("handler error will not be transferred properly, must return *errors.Error or proto.Message") + } // default case user pass own error type that not proto based statusCode = convertCode(verr) statusDesc = verr.Error() @@ -595,6 +598,9 @@ func (g *grpcServer) processStream(stream grpc.ServerStream, service *service, m return err } default: + if logger.V(logger.ErrorLevel) { + logger.Warn("handler error will not be transferred properly, must return *errors.Error or proto.Message") + } // default case user pass own error type that not proto based statusCode = convertCode(verr) statusDesc = verr.Error()