aboutsummaryrefslogtreecommitdiff
path: root/src/zenserver/config.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/zenserver/config.cpp')
-rw-r--r--src/zenserver/config.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp
index 08ba6dc95..e7edd5745 100644
--- a/src/zenserver/config.cpp
+++ b/src/zenserver/config.cpp
@@ -1337,9 +1337,18 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
try
{
- auto result = options.parse(argc, argv);
+ cxxopts::ParseResult Result;
- if (result.count("help"))
+ try
+ {
+ Result = options.parse(argc, argv);
+ }
+ catch (std::exception& Ex)
+ {
+ throw zen::OptionParseException(Ex.what());
+ }
+
+ if (Result.count("help"))
{
ZEN_CONSOLE("{}", options.help());
#if ZEN_PLATFORM_WINDOWS
@@ -1373,21 +1382,15 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions)
if (!ServerOptions.ConfigFile.empty())
{
- ParseConfigFile(ServerOptions.ConfigFile, ServerOptions, result, OutputConfigFile);
+ ParseConfigFile(ServerOptions.ConfigFile, ServerOptions, Result, OutputConfigFile);
}
else
{
- ParseConfigFile(ServerOptions.DataDir / "zen_cfg.lua", ServerOptions, result, OutputConfigFile);
+ ParseConfigFile(ServerOptions.DataDir / "zen_cfg.lua", ServerOptions, Result, OutputConfigFile);
}
ValidateOptions(ServerOptions);
}
- catch (cxxopts::OptionParseException& e)
- {
- ZEN_CONSOLE_ERROR("Error parsing zenserver arguments: {}\n\n{}", e.what(), options.help());
-
- throw;
- }
catch (zen::OptionParseException& e)
{
ZEN_CONSOLE_ERROR("Error parsing zenserver arguments: {}\n\n{}", e.what(), options.help());