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>
pull/4811/head
Harvey Tuch 7 years ago
parent 761a6275d4
commit 44a2a2fcab
  1. 3
      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,

Loading…
Cancel
Save