From 435d63b8710b9cb83e3026257d54fe494da6f880 Mon Sep 17 00:00:00 2001 From: Pedro Alvarez Date: Fri, 12 Apr 2019 14:38:06 +0100 Subject: [PATCH] Making sure errors in the enb.conf is handled gracefully --- srsenb/src/main.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/srsenb/src/main.cc b/srsenb/src/main.cc index 789835943..ced44ba1f 100644 --- a/srsenb/src/main.cc +++ b/srsenb/src/main.cc @@ -212,8 +212,15 @@ void parse_args(all_args_t *args, int argc, char* argv[]) { cout << "Failed to read configuration file " << config_file << " - exiting" << endl; exit(1); } - bpo::store(bpo::parse_config_file(conf, common), vm); - bpo::notify(vm); + + // parse config file and handle errors gracefully + try { + bpo::store(bpo::parse_config_file(conf, common), vm); + bpo::notify(vm); + } catch (const boost::program_options::error& e) { + cerr << e.what() << endl; + exit(1); + } // Convert hex strings {