summaryrefslogtreecommitdiff
path: root/src/mongo/shell/mongo.js
diff options
context:
space:
mode:
authordaveh86 <howsdav@gmail.com>2014-05-14 19:43:38 -0400
committerBenety Goh <benety@mongodb.com>2014-05-22 09:17:09 -0400
commit0e224f9a0fe0a37ee2b22c0a0ba20ec2a1f48aeb (patch)
tree4e7cbbd2f720c6e21a35b8d1b4d493522fbd8291 /src/mongo/shell/mongo.js
parent885e11b64dae39b4a90304e754caa26254442180 (diff)
downloadmongo-0e224f9a0fe0a37ee2b22c0a0ba20ec2a1f48aeb.tar.gz
SERVER-10177 Remove all Js instances of "throw 'string';" with "throw Error();"
Includes both the initial patch to remove all throws and patches for all failing tests Signed-off-by: Benety Goh <benety@mongodb.com>
Diffstat (limited to 'src/mongo/shell/mongo.js')
-rw-r--r--src/mongo/shell/mongo.js14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/shell/mongo.js b/src/mongo/shell/mongo.js
index 422598ecad1..df8d825c4d5 100644
--- a/src/mongo/shell/mongo.js
+++ b/src/mongo/shell/mongo.js
@@ -8,17 +8,17 @@ if ( typeof Mongo == "undefined" ){
}
if ( ! Mongo.prototype ){
- throw "Mongo.prototype not defined";
+ throw Error("Mongo.prototype not defined");
}
if ( ! Mongo.prototype.find )
- Mongo.prototype.find = function( ns , query , fields , limit , skip , batchSize , options ){ throw "find not implemented"; }
+ Mongo.prototype.find = function( ns , query , fields , limit , skip , batchSize , options ){ throw Error("find not implemented"); }
if ( ! Mongo.prototype.insert )
- Mongo.prototype.insert = function( ns , obj ){ throw "insert not implemented"; }
+ Mongo.prototype.insert = function( ns , obj ){ throw Error("insert not implemented"); }
if ( ! Mongo.prototype.remove )
- Mongo.prototype.remove = function( ns , pattern ){ throw "remove not implemented;" }
+ Mongo.prototype.remove = function( ns , pattern ){ throw Error("remove not implemented"); }
if ( ! Mongo.prototype.update )
- Mongo.prototype.update = function( ns , query , obj , upsert ){ throw "update not implemented;" }
+ Mongo.prototype.update = function( ns , query , obj , upsert ){ throw Error("update not implemented"); }
if ( typeof mongoInject == "function" ){
mongoInject( Mongo.prototype );
@@ -44,7 +44,7 @@ Mongo.prototype.getDB = function( name ){
Mongo.prototype.getDBs = function(){
var res = this.getDB( "admin" ).runCommand( { "listDatabases" : 1 } );
if ( ! res.ok )
- throw "listDatabases failed:" + tojson( res );
+ throw Error( "listDatabases failed:" + tojson( res ) );
return res;
}
@@ -67,7 +67,7 @@ Mongo.prototype.getDBNames = function(){
Mongo.prototype.getCollection = function(ns){
var idx = ns.indexOf( "." );
if ( idx < 0 )
- throw "need . in ns";
+ throw Error("need . in ns");
var db = ns.substring( 0 , idx );
var c = ns.substring( idx + 1 );
return this.getDB( db ).getCollection( c );