Просмотр исходного кода

json: include field name in InvalidName status messages.

This is invaluable for chasing down the culprit in failed JSON -> proto
conversions. We often see in Envoy that a failed JSON (or indirectly via
YAML) configuration won't load but it's unclear why.

Signed-off-by: Harvey Tuch <htuch@google.com>
Harvey Tuch 7 лет назад
Родитель
Сommit
44a2a2fcab
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      src/google/protobuf/util/json_util.cc

+ 2 - 1
src/google/protobuf/util/json_util.cc

@@ -127,7 +127,8 @@ class StatusErrorListener : public converter::ErrorListener {
   virtual void InvalidName(const converter::LocationTrackerInterface& loc,
                            StringPiece unknown_name, StringPiece message) {
     status_ = util::Status(util::error::INVALID_ARGUMENT,
-                             loc.ToString() + ": " + string(message));
+                           loc.ToString() + ":invalid name " +
+                               string(unknown_name) + ": " + string(message));
   }
 
   virtual void InvalidValue(const converter::LocationTrackerInterface& loc,