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/zen/zen.cpp | |
| parent | 247 complete httpclient implementation (#269) (diff) | |
| download | archived-zen-b4dd4279139f6496eace81723d0b20aa1275324e.tar.xz archived-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/zen/zen.cpp')
| -rw-r--r-- | src/zen/zen.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/zen/zen.cpp b/src/zen/zen.cpp index 9754f4434..7f0549d42 100644 --- a/src/zen/zen.cpp +++ b/src/zen/zen.cpp @@ -69,7 +69,7 @@ ZenCmdBase::ParseOptions(int argc, char** argv) First = false; } - throw cxxopts::OptionParseException(fmt::format("Invalid arguments: {}", StringBuilder.ToView())); + throw zen::OptionParseException(fmt::format("Invalid arguments: {}", StringBuilder.ToView())); } return true; @@ -397,6 +397,14 @@ main(int argc, char** argv) exit(11); } + catch (OptionParseException& Ex) + { + std::string help = VerbOptions.help(); + + printf("Error parsing arguments for command '%s': %s\n\n%s", SubCommand.c_str(), Ex.what(), help.c_str()); + + exit(11); + } } } @@ -410,6 +418,14 @@ main(int argc, char** argv) return 9; } + catch (OptionParseException& Ex) + { + std::string HelpMessage = Options.help(); + + printf("Error parsing program arguments: %s\n\n%s", Ex.what(), HelpMessage.c_str()); + + return 9; + } catch (std::exception& Ex) { printf("Exception caught from 'main': %s\n", Ex.what()); |