diff options
author | Spencer T Brody <spencer@mongodb.com> | 2017-10-05 19:04:36 -0400 |
---|---|---|
committer | Spencer T Brody <spencer@mongodb.com> | 2017-10-16 18:05:08 -0400 |
commit | 8b9703b98b30bbf37b65358f15c5fea0813ad3cf (patch) | |
tree | f7a882c989ce30d8703c49651718b20b992492d7 /src/mongo/shell/assert.js | |
parent | ae9262c5c48b378216f276ca150204dff63f04b4 (diff) | |
download | mongo-8b9703b98b30bbf37b65358f15c5fea0813ad3cf.tar.gz |
SERVER-31277 Cancel all user operations on heartbeat stepdown path
Diffstat (limited to 'src/mongo/shell/assert.js')
-rw-r--r-- | src/mongo/shell/assert.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/shell/assert.js b/src/mongo/shell/assert.js index 00ece505806..364a9b453ed 100644 --- a/src/mongo/shell/assert.js +++ b/src/mongo/shell/assert.js @@ -571,6 +571,8 @@ assert.writeError = function(res, msg) { return assert.writeErrorWithCode(res, null, msg); }; +// If expectedCode is an array then this asserts that the found code is one of the codes in +// the expectedCode array. assert.writeErrorWithCode = function(res, expectedCode, msg) { var errMsg = null; @@ -607,7 +609,12 @@ assert.writeErrorWithCode = function(res, expectedCode, msg) { } if (!errMsg && expectedCode) { - if (foundCode != expectedCode) { + if (Array.isArray(expectedCode)) { + if (!expectedCode.includes(foundCode)) { + errMsg = "found code " + foundCode + " does not match any of the expected codes " + + tojson(expectedCode); + } + } else if (foundCode != expectedCode) { errMsg = "found code " + foundCode + " does not match expected code " + expectedCode; } } |