summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTad Marshall <tad@10gen.com>2012-08-03 12:38:30 -0400
committerTad Marshall <tad@10gen.com>2012-08-08 09:18:09 -0400
commit25e2b7e057b90a5501e78f22105c8658e4479e74 (patch)
tree678e17cd076f33339503bdbf373bf57feb0351a8
parent3eec537d7e9534065a3fce91382da32b2769d204 (diff)
downloadmongo-25e2b7e057b90a5501e78f22105c8658e4479e74.tar.gz
SERVER-6704 show error message on failed "edit var" in shell
Display the JavaScript error and the line we tried to execute when we fail to assign back to the variable in the mongo shell's edit command.
-rw-r--r--src/mongo/shell/dbshell.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/mongo/shell/dbshell.cpp b/src/mongo/shell/dbshell.cpp
index 523d1827fb1..608c8ab77c7 100644
--- a/src/mongo/shell/dbshell.cpp
+++ b/src/mongo/shell/dbshell.cpp
@@ -589,8 +589,9 @@ static void edit( const string& whatToEdit ) {
if ( editingVariable ) {
// Try to execute assignment to copy edited value back into the variable
const string code = whatToEdit + string( " = " ) + sb.str();
- if ( !shellMainScope->exec( code, "tojs", false, false, false ) )
- return; // Error already printed
+ if ( !shellMainScope->exec( code, "tojs", false, true, false ) ) {
+ cout << "error executing assignment: " << code << endl;
+ }
}
else {
linenoisePreloadBuffer( sb.str().c_str() );