1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-30 12:43:52 +00:00

fix: avoid a warning about useless move (#678)

* fix: avoid a warning about useless move

* style: pre-commit.ci fixes

* Update include/CLI/App.hpp

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Henry Schreiner 2021-12-02 13:20:13 -05:00 committed by GitHub
parent 612f4584b6
commit f897aad11a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2252,27 +2252,24 @@ class App {
/// Process callbacks and such.
void _process() {
CLI::FileError fe("ne");
bool caught_error{false};
try {
// the config file might generate a FileError but that should not be processed until later in the process
// to allow for help, version and other errors to generate first.
_process_config_file();
// process env shouldn't throw but no reason to process it if config generated an error
_process_env();
} catch(const CLI::FileError &fe2) {
fe = fe2;
caught_error = true;
}
// callbacks and help_flags can generate exceptions which should take priority over the config file error if one
// exists
} catch(const CLI::FileError &) {
// callbacks and help_flags can generate exceptions which should take priority
// over the config file error if one exists.
_process_callbacks();
_process_help_flags();
if(caught_error) {
throw CLI::FileError(std::move(fe));
throw;
}
_process_callbacks();
_process_help_flags();
_process_requirements();
}