add warning when handler returns not *errors.Error or proto.Message error type
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
a41e085d18
commit
0d3d13b7ab
6
grpc.go
6
grpc.go
@ -476,6 +476,9 @@ func (g *grpcServer) processRequest(stream grpc.ServerStream, service *service,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
default:
|
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
|
// default case user pass own error type that not proto based
|
||||||
statusCode = convertCode(verr)
|
statusCode = convertCode(verr)
|
||||||
statusDesc = verr.Error()
|
statusDesc = verr.Error()
|
||||||
@ -595,6 +598,9 @@ func (g *grpcServer) processStream(stream grpc.ServerStream, service *service, m
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
default:
|
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
|
// default case user pass own error type that not proto based
|
||||||
statusCode = convertCode(verr)
|
statusCode = convertCode(verr)
|
||||||
statusDesc = verr.Error()
|
statusDesc = verr.Error()
|
||||||
|
Loading…
Reference in New Issue
Block a user