diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2023-04-25 11:20:55 -0400 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2023-04-25 11:20:55 -0400 |
| commit | 2f45d5c615492dffa456489d73543870e5a224ab (patch) | |
| tree | 6c57e958dc5f1e753a1f031ca7730650988f5f13 | |
| parent | e06129bb4d1076f4f2cebabddcee09f1e9e30dcc (diff) | |
| parent | ad80f1b357b706ef48016f5c1214ce4d87613caa (diff) | |
| download | monzero-core-2f45d5c615492dffa456489d73543870e5a224ab.tar.gz monzero-core-2f45d5c615492dffa456489d73543870e5a224ab.tar.xz monzero-core-2f45d5c615492dffa456489d73543870e5a224ab.zip | |
Merge pull request #8766
ad80f1b Handle case where a command line flag is not allowed in the config file (almalh)
| -rw-r--r-- | src/daemon/main.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/daemon/main.cpp b/src/daemon/main.cpp index 73d9ebce1..1d4baaa32 100644 --- a/src/daemon/main.cpp +++ b/src/daemon/main.cpp @@ -219,6 +219,19 @@ int main(int argc, char const * argv[]) { po::store(po::parse_config_file<char>(config_path.string<std::string>().c_str(), core_settings), vm); } + catch (const po::unknown_option &e) + { + std::string unrecognized_option = e.get_option_name(); + if (all_options.find_nothrow(unrecognized_option, false)) + { + std::cerr << "Option '" << unrecognized_option << "' is not allowed in the config file, please use it as a command line flag." << std::endl; + } + else + { + std::cerr << "Unrecognized option '" << unrecognized_option << "' in config file." << std::endl; + } + return 1; + } catch (const std::exception &e) { // log system isn't initialized yet |
