@@ -340,7 +340,8 @@ std::ostream& operator<<(std::ostream& os, Value const& v) {
340340}
341341
342342Status MakeDepthExceededError () {
343- return internal::InternalError (" Nested value depth exceeds 10 levels" );
343+ return internal::InternalError (" Nested value depth exceeds 10 levels" ,
344+ GCP_ERROR_INFO ());
344345}
345346
346347// NOLINTNEXTLINE(misc-no-recursion)
@@ -357,7 +358,7 @@ Status TypeAndArrayValuesMatch(google::bigtable::v2::Type const& type,
357358 auto const & vals = value.array_value ().values ();
358359 for (auto const & val : vals) {
359360 auto const element_match_result = Value::TypeAndValuesMatch (
360- type.array_type ().element_type (), val, depth + 1 );
361+ type.array_type ().element_type (), val, ++depth );
361362 if (!element_match_result.ok ()) {
362363 return element_match_result;
363364 }
@@ -388,13 +389,13 @@ Status TypeAndMapValuesMatch(google::bigtable::v2::Type const& type,
388389 auto map_value = val.array_value ().values (1 );
389390 // NOLINTNEXTLINE(misc-no-recursion)
390391 auto key_match_result =
391- Value::TypeAndValuesMatch (key_type, map_key, depth + 1 );
392+ Value::TypeAndValuesMatch (key_type, map_key, ++depth );
392393 if (!key_match_result.ok ()) {
393394 return key_match_result;
394395 }
395396 // NOLINTNEXTLINE(misc-no-recursion)
396397 auto value_match_result =
397- Value::TypeAndValuesMatch (value_type, map_value, depth + 1 );
398+ Value::TypeAndValuesMatch (value_type, map_value, ++depth );
398399 if (!value_match_result.ok ()) {
399400 return value_match_result;
400401 }
@@ -424,7 +425,7 @@ Status TypeAndStructValuesMatch(google::bigtable::v2::Type const& type,
424425 for (int i = 0 ; i < fields.size (); ++i) {
425426 auto const & f1 = fields.Get (i);
426427 auto const & v = values[i];
427- auto match_result = Value::TypeAndValuesMatch (f1.type (), v, depth + 1 );
428+ auto match_result = Value::TypeAndValuesMatch (f1.type (), v, ++depth );
428429 if (!match_result.ok ()) {
429430 return match_result;
430431 }
@@ -458,13 +459,13 @@ Status Value::TypeAndValuesMatch(google::bigtable::v2::Type const& type,
458459 Status result;
459460 switch (type.kind_case ()) {
460461 case Type::kArrayType :
461- result = TypeAndArrayValuesMatch (type, value, depth + 1 );
462+ result = TypeAndArrayValuesMatch (type, value, ++depth );
462463 break ;
463464 case Type::kMapType :
464- result = TypeAndMapValuesMatch (type, value, depth + 1 );
465+ result = TypeAndMapValuesMatch (type, value, ++depth );
465466 break ;
466467 case Type::kStructType :
467- result = TypeAndStructValuesMatch (type, value, depth + 1 );
468+ result = TypeAndStructValuesMatch (type, value, ++depth );
468469 break ;
469470 case Type::kBoolType :
470471 if (!value.has_bool_value ()) {
0 commit comments