Display error message for invalid command line arguments instead of crashing

This commit is contained in:
Eric Frias 2015-07-01 09:55:41 -04:00
parent fd94046eb6
commit 67bda9075f

View file

@ -52,6 +52,7 @@ int main(int argc, char** argv) {
auto history_plug = node.register_plugin<account_history::account_history_plugin>();
auto market_history_plug = node.register_plugin<market_history::market_history_plugin>();
try
{
bpo::options_description cli, cfg;
node.set_program_options(cli, cfg);
@ -59,6 +60,11 @@ int main(int argc, char** argv) {
cfg_options.add(cfg);
bpo::store(bpo::parse_command_line(argc, argv, app_options), options);
}
catch (const boost::program_options::error& e)
{
std::cerr << "Error parsing command line: " << e.what() << "\n";
return 1;
}
if( options.count("help") )
{