Skip to content

Commit 8a153d3

Browse files
fotiniAlvanakiMongoDB Bot
authored andcommitted
SERVER-100477 Create AssertionError class expression (#32018)
GitOrigin-RevId: ab15f5c
1 parent c840c34 commit 8a153d3

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

jstests/core/query/js/js_global_scope.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const expectedGlobalVars = [
2525
"AggregateError",
2626
"Array",
2727
"ArrayBuffer",
28+
"AssertionError",
2829
"BigInt",
2930
"BigInt64Array",
3031
"BigUint64Array",

src/mongo/shell/assert.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function _convertExceptionToReturnStatus(func, excMsg) {
9090
return safeFunc;
9191
}
9292

93-
class AssertionError extends Error {
93+
var AssertionError = class MongoAssertionError extends Error {
9494
constructor(message, id, attr) {
9595
super(message);
9696
// Properties that are always present ('message' is managed by the parent class).
@@ -116,7 +116,7 @@ class AssertionError extends Error {
116116
tojson() {
117117
return this.#serialize(tojson, arguments);
118118
}
119-
}
119+
};
120120

121121
assert = (function() {
122122
// Wrapping the helper function in an IIFE to avoid polluting the global namespace.

0 commit comments

Comments
 (0)