summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMike Dirolf <mike@10gen.com>2009-06-25 16:40:39 -0400
committerMike Dirolf <mike@10gen.com>2009-06-25 16:40:39 -0400
commit39c11c8283871be0943dd4120a9fccef2483ca40 (patch)
treeb6dfdb1246ed9795429703c7653d7a66286d900c /tools
parent97fe2a917776f30baf91c6068d72438cc117df9d (diff)
downloadmongo-39c11c8283871be0943dd4120a9fccef2483ca40.tar.gz
importjson: show help text for bad arguments
Diffstat (limited to 'tools')
-rw-r--r--tools/importJSON.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/tools/importJSON.cpp b/tools/importJSON.cpp
index 28bd48b72ba..dc776e27cce 100644
--- a/tools/importJSON.cpp
+++ b/tools/importJSON.cpp
@@ -47,6 +47,7 @@ public:
string filename = getParam( "file" );
if ( filename.size() == 0 ){
cerr << "need to specify a file!" << endl;
+ printHelp(cerr);
return -1;
}
@@ -59,7 +60,14 @@ public:
in = &file;
}
- string ns = getNS();
+ string ns;
+
+ try {
+ ns = getNS();
+ } catch (...) {
+ printHelp(cerr);
+ return -1;
+ }
if ( hasParam( "drop" ) ){
cout << "dropping: " << ns << endl;