diff options
| author | Stefan Boberg <[email protected]> | 2023-05-08 09:18:31 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2023-05-08 09:18:31 +0200 |
| commit | b4dd4279139f6496eace81723d0b20aa1275324e (patch) | |
| tree | ccd102edcbea9e127ee11a3cf890f00ceb15ad35 /src/zenserver/config.cpp | |
| parent | 247 complete httpclient implementation (#269) (diff) | |
| download | zen-b4dd4279139f6496eace81723d0b20aa1275324e.tar.xz zen-b4dd4279139f6496eace81723d0b20aa1275324e.zip | |
replace use of cxxopts::OptionParseException in our code
later versions of cxxopts changed the signatures of exceptions. This change adds zen::OptionParseException to replace it
Diffstat (limited to 'src/zenserver/config.cpp')
| -rw-r--r-- | src/zenserver/config.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/zenserver/config.cpp b/src/zenserver/config.cpp index d28262607..08ef17c12 100644 --- a/src/zenserver/config.cpp +++ b/src/zenserver/config.cpp @@ -5,6 +5,7 @@ #include "diag/logging.h" #include <zencore/crypto.h> +#include <zencore/except.h> #include <zencore/fmtutils.h> #include <zencore/iobuffer.h> #include <zencore/string.h> @@ -69,7 +70,7 @@ ValidateOptions(ZenServerOptions& ServerOptions) if (Key.IsValid() == false) { - throw cxxopts::OptionParseException("Invalid AES encryption key"); + throw zen::OptionParseException("Invalid AES encryption key"); } } @@ -79,7 +80,7 @@ ValidateOptions(ZenServerOptions& ServerOptions) if (IV.IsValid() == false) { - throw cxxopts::OptionParseException("Invalid AES initialization vector"); + throw zen::OptionParseException("Invalid AES initialization vector"); } } } @@ -581,7 +582,7 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions) { if (OpenIdClientId.empty()) { - throw cxxopts::OptionParseException("Invalid OpenID client ID"); + throw zen::OptionParseException("Invalid OpenID client ID"); } ServerOptions.AuthConfig.OpenIdProviders.push_back( @@ -607,6 +608,12 @@ ParseCliOptions(int argc, char* argv[], ZenServerOptions& ServerOptions) throw; } + catch (zen::OptionParseException& e) + { + zen::logging::ConsoleLog().error("Error parsing zenserver arguments: {}\n\n{}", e.what(), options.help()); + + throw; + } if (ServerOptions.DataDir.empty()) { |