diff options
author | dziana.hurynovich <dziana.hurynovich@mongodb.com> | 2022-12-20 08:18:50 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-12-20 08:53:27 +0000 |
commit | f84b645556a27b078b61260d55c53b664aff8b7f (patch) | |
tree | 1362782d5dd4c437ecd3b86fab83b91884a9ff15 | |
parent | a95672fe5d79b1f93164ab15743197ae9f4c6661 (diff) | |
download | mongo-f84b645556a27b078b61260d55c53b664aff8b7f.tar.gz |
Revert "SERVER-71512 Fix assert.commandWorkedOrFailedWithCode"
This reverts commit 72b203af76e771c0705bfa657c9df76fa48c4cd5.
-rw-r--r-- | src/mongo/shell/assert.js | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mongo/shell/assert.js b/src/mongo/shell/assert.js index 2e153854353..c42476a39f4 100644 --- a/src/mongo/shell/assert.js +++ b/src/mongo/shell/assert.js @@ -845,12 +845,10 @@ assert = (function() { assert.commandWorkedOrFailedWithCode = function commandWorkedOrFailedWithCode( res, errorCodeSet, msg) { - try { - // First check if the command worked. - return assert.commandWorked(res, msg); - } catch (e) { - // If the command did not work, assert it failed with one of the specified codes. + if (!res.ok) { return assert.commandFailedWithCode(res, errorCodeSet, msg); + } else { + return assert.commandWorked(res, msg); } }; |