From 40b3524b75c498759d91ce0b4c3ae8046db37911 Mon Sep 17 00:00:00 2001 From: Eliot Horowitz Date: Sat, 22 Jan 2011 00:38:52 -0500 Subject: commandHelp should complain if command doesn't exist SERVER-2392 --- shell/db.js | 5 ++++- shell/mongo_vstudio.cpp | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'shell') diff --git a/shell/db.js b/shell/db.js index 52f512e2554..0b95fe39c59 100644 --- a/shell/db.js +++ b/shell/db.js @@ -34,7 +34,10 @@ DB.prototype.commandHelp = function( name ){ var c = {}; c[name] = 1; c.help = true; - return this.runCommand( c ).help; + var res = this.runCommand( c ); + if ( ! res.ok ) + throw res.errmsg; + return res.help; } DB.prototype.runCommand = function( obj ){ diff --git a/shell/mongo_vstudio.cpp b/shell/mongo_vstudio.cpp index cfed6186a10..0f56c4184ed 100644 --- a/shell/mongo_vstudio.cpp +++ b/shell/mongo_vstudio.cpp @@ -1517,7 +1517,10 @@ const StringData _jscode_raw_db = "var c = {};\n" "c[name] = 1;\n" "c.help = true;\n" -"return this.runCommand( c ).help;\n" +"var res = this.runCommand( c );\n" +"if ( ! res.ok )\n" +"throw res.errmsg;\n" +"return res.help;\n" "}\n" "\n" "DB.prototype.runCommand = function( obj ){\n" -- cgit v1.2.1