diff options
Diffstat (limited to 'src/mongo/unittest/death_test.cpp')
-rw-r--r-- | src/mongo/unittest/death_test.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mongo/unittest/death_test.cpp b/src/mongo/unittest/death_test.cpp index b33900aff90..50ec0fda6db 100644 --- a/src/mongo/unittest/death_test.cpp +++ b/src/mongo/unittest/death_test.cpp @@ -118,8 +118,14 @@ void DeathTestBase::_doTest() { line = line.substr(0, line.size() - 1); if (line.empty()) continue; - int parsedLen; - auto parsedChildLog = fromjson(lineBuf, &parsedLen); + int parsedLen = 0; + BSONObj parsedChildLog; + try { + parsedChildLog = fromjson(lineBuf, &parsedLen); + } catch (DBException&) { + // ignore json parsing errors and dump the whole log line as text + parsedLen = 0; + } if (static_cast<size_t>(parsedLen) == line.size()) { LOGV2(20165, "child", "json"_attr = parsedChildLog); } else { |