aboutsummaryrefslogtreecommitdiff
path: root/src/daemon/main.cpp
diff options
context:
space:
mode:
authoralmalh <almalh@proton.me>2023-03-05 19:58:46 -0500
committeralmalh <almalh@proton.me>2023-03-06 17:41:24 -0500
commitad80f1b357b706ef48016f5c1214ce4d87613caa (patch)
treeba895ff5f6eeafde5b7d0bcbcbb89f7edf128034 /src/daemon/main.cpp
parentMerge pull request #8739 (diff)
downloadmonero-ad80f1b357b706ef48016f5c1214ce4d87613caa.tar.xz
Handle case where a command line flag is not allowed in the config file
Diffstat (limited to 'src/daemon/main.cpp')
-rw-r--r--src/daemon/main.cpp13
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