rpc: extend error log message for failed RPC requests

Message is always non-empty; Data is allowed to be empty.
This commit is contained in:
Anna Shaleva 2022-06-23 17:41:28 +03:00
parent 5108d1c2c7
commit 9488756437

View file

@ -2260,7 +2260,10 @@ func (s *Server) packResponse(r *request.In, result interface{}, respErr *respon
// logRequestError is a request error logger.
func (s *Server) logRequestError(r *request.Request, jsonErr *response.Error) {
logFields := []zap.Field{
zap.String("cause", jsonErr.Data),
zap.Int64("code", jsonErr.Code),
}
if len(jsonErr.Data) != 0 {
logFields = append(logFields, zap.String("cause", jsonErr.Data))
}
if r.In != nil {