@@ -339,12 +339,16 @@ std::ostream& operator<<(std::ostream& os, Value const& v) {
339339 return StreamHelper (os, v.value_ , v.type_ , StreamMode::kScalar );
340340}
341341
342+ Status Value::MakeDepthExceededError () {
343+ return internal::InternalError (" Nested value depth exceeds 10 levels" );
344+ }
345+
342346// NOLINTNEXTLINE(misc-no-recursion)
343347Status Value::TypeAndArrayValuesMatch (google::bigtable::v2::Type const & type,
344348 google::bigtable::v2::Value const & value,
345349 int depth) {
346350 if (depth > 10 ) {
347- return internal::InternalError ( " Nested value depth exceeds 10 levels " );
351+ return MakeDepthExceededError ( );
348352 }
349353 if (!value.has_array_value ()) {
350354 return internal::InternalError (
@@ -366,7 +370,7 @@ Status Value::TypeAndMapValuesMatch(google::bigtable::v2::Type const& type,
366370 google::bigtable::v2::Value const & value,
367371 int depth) {
368372 if (depth > 10 ) {
369- return internal::InternalError ( " Nested value depth exceeds 10 levels " );
373+ return MakeDepthExceededError ( );
370374 }
371375 if (!value.has_array_value ()) {
372376 return internal::InternalError (
@@ -402,7 +406,7 @@ Status Value::TypeAndStructValuesMatch(google::bigtable::v2::Type const& type,
402406 google::bigtable::v2::Value const & value,
403407 int depth) {
404408 if (depth > 10 ) {
405- return internal::InternalError ( " Nested value depth exceeds 10 levels " );
409+ return MakeDepthExceededError ( );
406410 }
407411 if (!value.has_array_value ()) {
408412 return internal::InternalError (
@@ -437,7 +441,7 @@ Status Value::TypeAndValuesMatch(google::bigtable::v2::Type const& type,
437441 google::bigtable::v2::Value const & value,
438442 int depth) {
439443 if (depth > 10 ) {
440- return internal::InternalError ( " Nested value depth exceeds 10 levels " );
444+ return MakeDepthExceededError ( );
441445 }
442446 using google::bigtable::v2::Type;
443447 auto make_mismatch_metadata_status = [&](std::string const & value_kind,
0 commit comments