Display error message for invalid command line arguments instead of crashing
This commit is contained in:
parent
fd94046eb6
commit
67bda9075f
1 changed files with 6 additions and 0 deletions
|
|
@ -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") )
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue