SERVER-113573 Remove "Extension encountered error" prefix from extension uasserts (#43680)

GitOrigin-RevId: 02d6f66bb97aba0433272f9e7ec464f4aa95ebd6
This commit is contained in:
Finley Lau 2025-11-06 16:10:34 -06:00 committed by MongoDB Bot
parent 966de10cbe
commit 0560e59a0f
3 changed files with 4 additions and 6 deletions

View File

@ -28,7 +28,8 @@ function checkAssertionFailure({errmsg, code, assertionType}) {
}),
code,
);
assert.eq(res.errmsg, "Extension encountered error: " + errmsg, res);
const expectedErrMsg = assertionType == "uassert" ? errmsg : "Extension encountered error: " + errmsg;
assert.eq(res.errmsg, expectedErrMsg, res);
return res;
}

View File

@ -400,9 +400,7 @@ TEST_F(ExtensionErrorsTest, ExtensionUasserts) {
BSON("$assert" << BSON("errmsg" << "a new error" << "code" << 54321 << "assertionType"
<< "uassert"))};
ASSERT_THROWS_CODE(Pipeline::parse(pipeline, expCtx), AssertionException, 54321);
ASSERT_THROWS_WHAT(Pipeline::parse(pipeline, expCtx),
AssertionException,
"Extension encountered error: a new error");
ASSERT_THROWS_WHAT(Pipeline::parse(pipeline, expCtx), AssertionException, "a new error");
}
DEATH_TEST_REGEX_F(ExtensionErrorsTest, ExtensionTasserts, "98765.*another new error") {

View File

@ -132,8 +132,7 @@ MongoExtensionStatus* HostServicesAdapter::_extLogDebug(
errorBson, IDLParserContext("extUassert"));
// Call the host's uassert implementation.
uasserted(exceptionInfo.getErrorCode(),
"Extension encountered error: " + exceptionInfo.getMessage());
uasserted(exceptionInfo.getErrorCode(), exceptionInfo.getMessage());
});
}