diff options
author | Mathias Stearn <mathias@10gen.com> | 2017-10-16 18:59:08 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2017-11-02 14:25:21 -0400 |
commit | a0ebc55db521792632fb3ece87edafec327cc2a9 (patch) | |
tree | b2098c89f241082a9c1a55ed69794eef210aa312 /src/mongo/logger | |
parent | 9f8696b5ba4c9310749c5c3f1ee082c5f663b5b0 (diff) | |
download | mongo-a0ebc55db521792632fb3ece87edafec327cc2a9.tar.gz |
SERVER-31622 Fix bad throws
Diffstat (limited to 'src/mongo/logger')
-rw-r--r-- | src/mongo/logger/redaction_test.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/logger/redaction_test.cpp b/src/mongo/logger/redaction_test.cpp index e1f12d6c4ab..7674d9e449b 100644 --- a/src/mongo/logger/redaction_test.cpp +++ b/src/mongo/logger/redaction_test.cpp @@ -53,14 +53,17 @@ TEST(RedactStatusTest, StatusOK) { TEST(RedactExceptionTest, NoRedact) { logger::globalLogDomain()->setShouldRedactLogs(false); - DBException ex(ErrorCodes::InternalError, kMsg); - ASSERT_EQ(redact(ex), ex.toString()); + ASSERT_THROWS_WITH_CHECK(uasserted(ErrorCodes::InternalError, kMsg), + DBException, + [](const DBException& ex) { ASSERT_EQ(redact(ex), ex.toString()); }); } TEST(RedactExceptionTest, BasicException) { logger::globalLogDomain()->setShouldRedactLogs(true); - DBException ex(ErrorCodes::InternalError, kMsg); - ASSERT_EQ(redact(ex), "InternalError ###"); + ASSERT_THROWS_WITH_CHECK( + uasserted(ErrorCodes::InternalError, kMsg), DBException, [](const DBException& ex) { + ASSERT_EQ(redact(ex), "InternalError ###"); + }); } TEST(RedactBSONTest, NoRedact) { |