diff options
Diffstat (limited to 'src/mongo/shell/assert.js')
| -rw-r--r-- | src/mongo/shell/assert.js | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/mongo/shell/assert.js b/src/mongo/shell/assert.js index 6579443ae2e..ff168bd865d 100644 --- a/src/mongo/shell/assert.js +++ b/src/mongo/shell/assert.js @@ -110,8 +110,7 @@ assert = (function() { doassert("msg function cannot expect any parameters."); } } else if (typeof msg !== "string" && typeof msg !== "object") { - doassert("msg parameter must be a string, function or object. Found type: " + - typeof (msg)); + doassert("msg parameter must be a string, function or object."); } if (msg && assert._debug) { @@ -842,12 +841,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); } }; |
