diff options
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/aggregation/extras/utils.js | 2 | ||||
-rw-r--r-- | jstests/auth/basic_role_auth.js | 10 | ||||
-rw-r--r-- | jstests/core/count10.js | 4 | ||||
-rw-r--r-- | jstests/core/fts_projection.js | 4 | ||||
-rw-r--r-- | jstests/core/shellkillop.js | 4 | ||||
-rw-r--r-- | jstests/core/shellstartparallel.js | 4 | ||||
-rw-r--r-- | jstests/libs/command_line/test_parsed_options.js | 4 | ||||
-rw-r--r-- | jstests/libs/test_background_ops.js | 4 | ||||
-rw-r--r-- | jstests/multiVersion/libs/data_generators.js | 4 | ||||
-rw-r--r-- | jstests/multiVersion/libs/verify_collection_data.js | 2 | ||||
-rw-r--r-- | jstests/noPassthrough/query_yield2.js | 6 | ||||
-rw-r--r-- | jstests/replsets/auth1.js | 2 | ||||
-rw-r--r-- | jstests/replsets/maintenance.js | 2 | ||||
-rwxr-xr-x | jstests/replsets/rollback3.js | 2 | ||||
-rw-r--r-- | jstests/sharding/bad_config_load.js | 2 | ||||
-rw-r--r-- | jstests/sharding/geo_near_random1.js | 2 | ||||
-rw-r--r-- | jstests/sharding/geo_near_random2.js | 2 | ||||
-rw-r--r-- | jstests/sharding/sync2.js | 2 | ||||
-rw-r--r-- | jstests/slow1/sharding_multiple_collections.js | 2 | ||||
-rwxr-xr-x | jstests/slow2/32bit.js | 2 |
20 files changed, 33 insertions, 33 deletions
diff --git a/jstests/aggregation/extras/utils.js b/jstests/aggregation/extras/utils.js index 972db80d43e..d0a13f820cb 100644 --- a/jstests/aggregation/extras/utils.js +++ b/jstests/aggregation/extras/utils.js @@ -261,7 +261,7 @@ function assertErrorCode(coll, pipe, code, errmsg) { var cursor = new DBCommandCursor(coll.getMongo(), cursorRes, followupBatchSize); var error = assert.throws(function(){cursor.itcount()}, [], "expected error: " + code); - if (!error.search(code)) { + if (!error.message.search(code)) { assert(false, "expected error: " + code + " got: " + error); } } diff --git a/jstests/auth/basic_role_auth.js b/jstests/auth/basic_role_auth.js index 35e6b468164..801a5d64ecd 100644 --- a/jstests/auth/basic_role_auth.js +++ b/jstests/auth/basic_role_auth.js @@ -152,7 +152,7 @@ var testOps = function(db, allowedActions) { var res = db.killOp(1); if (res.err == 'unauthorized') { - throw 'unauthorized killOp'; + throw Error("unauthorized killOp"); } }); @@ -160,7 +160,7 @@ var testOps = function(db, allowedActions) { var res = db.currentOp(); if (res.err == 'unauthorized') { - throw 'unauthorized currentOp'; + throw Error("unauthorized currentOp"); } }); @@ -171,7 +171,7 @@ var testOps = function(db, allowedActions) { checkErr(allowedActions.hasOwnProperty('index_w'), function() { var res = db.user.ensureIndex({ x: 1 }); if (res.code == 13) { // Unauthorized - throw 'unauthorized currentOp'; + throw Error("unauthorized currentOp"); } }); @@ -239,7 +239,7 @@ var testOps = function(db, allowedActions) { var res = db.fsyncUnlock(); if (res.err == 'unauthorized') { - throw 'unauthorized fsync unlock'; + throw Error("unauthorized unauthorized fsyncUnlock"); } }); } @@ -529,7 +529,7 @@ var runTests = function(conn) { if (failures.length > 0) { var list = ''; failures.forEach(function(test) { list += (test + '\n'); }); - throw 'Tests failed:\n' + list; + throw Error('Tests failed:\n' + list); } }; diff --git a/jstests/core/count10.js b/jstests/core/count10.js index 21243b3151d..ef739d1a88e 100644 --- a/jstests/core/count10.js +++ b/jstests/core/count10.js @@ -52,8 +52,8 @@ jsTest.log("count10.js: killed count output start"); printjson(res); jsTest.log("count10.js: killed count output end"); assert(res); -assert(res.match(/count failed/) !== null); -assert(res.match(/\"code\"/) !== null); +assert(res.message.match(/count failed/) !== null); +assert(res.message.match(/\"code\"/) !== null); s(); diff --git a/jstests/core/fts_projection.js b/jstests/core/fts_projection.js index 9bdb9dbca8a..60bb445a7b3 100644 --- a/jstests/core/fts_projection.js +++ b/jstests/core/fts_projection.js @@ -85,9 +85,9 @@ assert.throws( function() { throw e; } }, null, 'Expected error from failed TEXT under OR planning'); -assert.neq(-1, errorMessage.indexOf('TEXT'), +assert.neq(-1, errorMessage.message.indexOf('TEXT'), 'message from failed text planning does not mention TEXT: ' + errorMessage); -assert.neq(-1, errorMessage.indexOf('OR'), +assert.neq(-1, errorMessage.message.indexOf('OR'), 'message from failed text planning does not mention OR: ' + errorMessage); // Scores should exist. diff --git a/jstests/core/shellkillop.js b/jstests/core/shellkillop.js index d903f251f13..b54ff74e237 100644 --- a/jstests/core/shellkillop.js +++ b/jstests/core/shellkillop.js @@ -33,8 +33,8 @@ if (true) { // toggle to disable test var inprog = db.currentOp().inprog; for (i in inprog) { - if (inprog[i].ns == "test." + baseName) - throw "shellkillop.js op is still running: " + tojson( inprog[i] ); + if (inprog[i].ns == "test." + baseName) + throw Error( "shellkillop.js op is still running: " + tojson( inprog[i] ) ); } retry = true; diff --git a/jstests/core/shellstartparallel.js b/jstests/core/shellstartparallel.js index 290dd3da2f1..9a8efe038b4 100644 --- a/jstests/core/shellstartparallel.js +++ b/jstests/core/shellstartparallel.js @@ -1,5 +1,5 @@ function f() { - throw "intentional_throw_to_test_assert_throws"; + throw Error("intentional_throw_to_test_assert_throws"); } assert.throws(f); @@ -10,7 +10,7 @@ join(); assert.eq(1, db.sps.count(), "join problem?"); // test with a throw -join = startParallelShell("db.sps.insert({x:1}); throw 'intentionally_uncaught';"); +join = startParallelShell("db.sps.insert({x:1}); throw Error('intentionally_uncaught');"); join(); assert.eq(2, db.sps.count(), "join2 problem?"); diff --git a/jstests/libs/command_line/test_parsed_options.js b/jstests/libs/command_line/test_parsed_options.js index e2ca646b63a..d7813953b8b 100644 --- a/jstests/libs/command_line/test_parsed_options.js +++ b/jstests/libs/command_line/test_parsed_options.js @@ -7,7 +7,7 @@ function mergeOptions(obj1, obj2) { if (typeof obj1[attrname] === "object" && typeof obj2[attrname] !== "undefined") { if (typeof obj2[attrname] !== "object") { - throw "Objects being merged must have the same structure"; + throw Error("Objects being merged must have the same structure"); } obj3[attrname] = mergeOptions(obj1[attrname], obj2[attrname]); } @@ -19,7 +19,7 @@ function mergeOptions(obj1, obj2) { if (typeof obj2[attrname] === "object" && typeof obj1[attrname] !== "undefined") { if (typeof obj1[attrname] !== "object") { - throw "Objects being merged must have the same structure"; + throw Error("Objects being merged must have the same structure"); } // Already handled above } diff --git a/jstests/libs/test_background_ops.js b/jstests/libs/test_background_ops.js index 91f50aaa362..b3f6f593947 100644 --- a/jstests/libs/test_background_ops.js +++ b/jstests/libs/test_background_ops.js @@ -205,8 +205,8 @@ startParallelOps = function( mongo, proc, args, context ){ assert.neq( result, null ) - if( result.err ) throw "Error in parallel ops " + procName + " : " - + tojson( result.err ) + if( result.err ) throw Error("Error in parallel ops " + procName + " : " + + tojson( result.err ) ) else return result.result } diff --git a/jstests/multiVersion/libs/data_generators.js b/jstests/multiVersion/libs/data_generators.js index 610dbd14b8a..6bab9f4ffe9 100644 --- a/jstests/multiVersion/libs/data_generators.js +++ b/jstests/multiVersion/libs/data_generators.js @@ -624,12 +624,12 @@ function CollectionMetadataGenerator(options) { if (options.hasOwnProperty(option)) { if (option === 'capped') { if (typeof(options['capped']) !== 'boolean') { - throw "\"capped\" options must be boolean in CollectionMetadataGenerator"; + throw Error("\"capped\" options must be boolean in CollectionMetadataGenerator"); } capped = options['capped']; } else { - throw "Unsupported key in options passed to CollectionMetadataGenerator: " + option; + throw Error("Unsupported key in options passed to CollectionMetadataGenerator: " + option); } } } diff --git a/jstests/multiVersion/libs/verify_collection_data.js b/jstests/multiVersion/libs/verify_collection_data.js index de0c8270db5..bb1d1a3ddab 100644 --- a/jstests/multiVersion/libs/verify_collection_data.js +++ b/jstests/multiVersion/libs/verify_collection_data.js @@ -98,7 +98,7 @@ function CollectionDataValidator() { this.validateCollectionData = function (collection) { if (!initialized) { - throw "validateCollectionWithAllData called, but data is not initialized"; + throw Error("validateCollectionWithAllData called, but data is not initialized"); } // Get the metadata for this collection diff --git a/jstests/noPassthrough/query_yield2.js b/jstests/noPassthrough/query_yield2.js index b2262d6b357..e1fc2a7ed75 100644 --- a/jstests/noPassthrough/query_yield2.js +++ b/jstests/noPassthrough/query_yield2.js @@ -63,7 +63,7 @@ print( tojson( currentOp ) ); len = currentOp.inprog.length; if ( len ) { print( "Shell ==== This test is broken: db.currentOp().inprog.length is " + len ); - throw "query_yield2.js test is broken"; + throw Error("query_yield2.js test is broken"); } print( "Shell ==== The test is working so far: db.currentOp().inprog.length is " + len ); @@ -111,7 +111,7 @@ while ( ( (new Date()).getTime() - start ) < ( time * 2 ) ) { print( "Shell ==== TEST FAILED! db.currentOp().inprog.length is " + len ); print( "Shell ==== Dump of db.currentOp:" ); print( tojson( currentOp ) ); - throw "TEST FAILED!"; + throw Error("TEST FAILED!"); } } assert.gt( 200, insertTime, "Insert took too long (" + insertTime + " ms), should be less than 200 ms" ); @@ -130,7 +130,7 @@ if ( len != 0 ) { print( "Shell ==== Final sanity check FAILED! db.currentOp().inprog.length is " + len ); print( "Shell ==== Dump of db.currentOp:" ); print( tojson( currentOp ) ); - throw "TEST FAILED!"; + throw Error("TEST FAILED!"); } print( "Shell ==== Test completed successfully, shutting down server" ); testServer.stop(); diff --git a/jstests/replsets/auth1.js b/jstests/replsets/auth1.js index f10b6b777bc..4038891bd8b 100644 --- a/jstests/replsets/auth1.js +++ b/jstests/replsets/auth1.js @@ -78,7 +78,7 @@ function doQueryOn(p) { } catch(e) { if (typeof(JSON) != "undefined") { - err = JSON.parse(e.substring(6)); + err = JSON.parse(e.message.substring(6)); } else if (e.indexOf("13") > 0) { err.code = 13; diff --git a/jstests/replsets/maintenance.js b/jstests/replsets/maintenance.js index 7259e6b9acb..506e885e0c4 100644 --- a/jstests/replsets/maintenance.js +++ b/jstests/replsets/maintenance.js @@ -78,7 +78,7 @@ var ex = assert.throws( [] /*no params*/, "getmore didn't fail") -assert(ex.match("13436"), "wrong error code -- " + ex ); +assert(ex.message.match("13436"), "wrong error code -- " + ex ); result = conns[1].getDB("admin").runCommand({replSetMaintenance : 0}); assert.eq(result.ok, 1, tojson(result)); diff --git a/jstests/replsets/rollback3.js b/jstests/replsets/rollback3.js index 188394a1263..9b17544032c 100755 --- a/jstests/replsets/rollback3.js +++ b/jstests/replsets/rollback3.js @@ -47,7 +47,7 @@ function wait(f) { } if (n == 200) { print("rollback3.js failing waited too long"); - throw "wait error"; + throw Error("wait error"); } sleep(1000); } diff --git a/jstests/sharding/bad_config_load.js b/jstests/sharding/bad_config_load.js index 9b509e09655..62437e5521c 100644 --- a/jstests/sharding/bad_config_load.js +++ b/jstests/sharding/bad_config_load.js @@ -43,7 +43,7 @@ for( var i = 0; i < 2; i++ ){ // Make sure we get a transport error, and not a no-primary error // Unfortunately e gets stringified so we have to test this way - assert( e.indexOf( "10276" ) >= 0 || e.indexOf( "socket" ) >= 0 ) + assert( e.message.indexOf( "10276" ) >= 0 || e.message.indexOf( "socket" ) >= 0 ) } } diff --git a/jstests/sharding/geo_near_random1.js b/jstests/sharding/geo_near_random1.js index 4a57b881528..1284e9b893e 100644 --- a/jstests/sharding/geo_near_random1.js +++ b/jstests/sharding/geo_near_random1.js @@ -22,7 +22,7 @@ for (var i = (test.nPts/10); i < test.nPts; i+= (test.nPts/10)){ to: ('shard000' + (i%3)), _waitForDelete: true }); } catch (e) { // ignore this error - if (! e.match(/that chunk is already on that shard/)){ + if (! e.message.match(/that chunk is already on that shard/)){ throw e; } } diff --git a/jstests/sharding/geo_near_random2.js b/jstests/sharding/geo_near_random2.js index 6bde3bc7456..621295ebc8d 100644 --- a/jstests/sharding/geo_near_random2.js +++ b/jstests/sharding/geo_near_random2.js @@ -21,7 +21,7 @@ for (var i = (test.nPts/10); i < test.nPts; i+= (test.nPts/10)){ s.adminCommand({moveChunk: ('test.' + testName), find: {_id: i-1}, to: ('shard000' + (i%3)), _waitForDelete : true }); } catch (e) { // ignore this error - if (! e.match(/that chunk is already on that shard/)){ + if (! e.message.match(/that chunk is already on that shard/)){ throw e; } } diff --git a/jstests/sharding/sync2.js b/jstests/sharding/sync2.js index cba7faafd89..4f5eee99438 100644 --- a/jstests/sharding/sync2.js +++ b/jstests/sharding/sync2.js @@ -96,7 +96,7 @@ for ( i=1; i<hashes.length; i++ ){ } if ( bad ) - throw "hashes different"; + throw Error("hashes different"); } s.stop(); diff --git a/jstests/slow1/sharding_multiple_collections.js b/jstests/slow1/sharding_multiple_collections.js index 7c2cb1720cf..6577e0050fa 100644 --- a/jstests/slow1/sharding_multiple_collections.js +++ b/jstests/slow1/sharding_multiple_collections.js @@ -27,7 +27,7 @@ function mytest( coll , i , loopNumber ){ x = coll.find( { _id : i } ).explain(); if ( x ) return; - throw "can't find " + i + " in " + coll.getName() + " on loopNumber: " + loopNumber + " explain: " + tojson( x ); + throw Error( "can't find " + i + " in " + coll.getName() + " on loopNumber: " + loopNumber + " explain: " + tojson( x ) ); } loopNumber = 0 diff --git a/jstests/slow2/32bit.js b/jstests/slow2/32bit.js index a149ea3e8dd..5881b2eea71 100755 --- a/jstests/slow2/32bit.js +++ b/jstests/slow2/32bit.js @@ -106,7 +106,7 @@ function f() { print(res.result);
printjson(res);
//mydb.dropDatabase();
- throw "fail validating 32bit.js";
+ throw Error("fail validating 32bit.js");
}
mydb.dropDatabase();
|