summaryrefslogtreecommitdiff
path: root/main.cc
diff options
context:
space:
mode:
authorJohn Wiegley <johnw@newartisans.com>2008-07-22 00:58:46 -0400
committerJohn Wiegley <johnw@newartisans.com>2008-07-22 00:58:46 -0400
commite41dbc204a5269d89b8909546d44927a58e29675 (patch)
treee8c4564c45fae95285cfa85b3e9e334a8c385227 /main.cc
parentaa4f0d4364783ed5cbc97972755c7fd6b0da3cf0 (diff)
downloadfork-ledger-e41dbc204a5269d89b8909546d44927a58e29675.tar.gz
fork-ledger-e41dbc204a5269d89b8909546d44927a58e29675.tar.bz2
fork-ledger-e41dbc204a5269d89b8909546d44927a58e29675.zip
Report an error if the user forgets to pass an argument to --trace.
Diffstat (limited to 'main.cc')
-rw-r--r--main.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/main.cc b/main.cc
index 76517668..fc6d06b5 100644
--- a/main.cc
+++ b/main.cc
@@ -373,7 +373,14 @@ int main(int argc, char * argv[], char * envp[])
else if (i + 1 < argc && std::strcmp(argv[i], "--trace") == 0) {
#if defined(TRACING_ON)
ledger::_log_level = ledger::LOG_TRACE;
- ledger::_trace_level = boost::lexical_cast<int>(argv[i + 1]);
+ try {
+ ledger::_trace_level = boost::lexical_cast<int>(argv[i + 1]);
+ }
+ catch (const boost::bad_lexical_cast& e) {
+ std::cerr << "Argument to --trace must be an integer."
+ << std::endl;
+ return 1;
+ }
i++;
#endif
}