Commit f897aad11a56eaf4d87c83b050857f2dd5367e6b
Committed by
GitHub
1 parent
612f4584
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>
Showing
1 changed file
with
8 additions
and
11 deletions
include/CLI/App.hpp
| ... | ... | @@ -2252,27 +2252,24 @@ class App { |
| 2252 | 2252 | |
| 2253 | 2253 | /// Process callbacks and such. |
| 2254 | 2254 | void _process() { |
| 2255 | - CLI::FileError fe("ne"); | |
| 2256 | - bool caught_error{false}; | |
| 2257 | 2255 | try { |
| 2258 | 2256 | // the config file might generate a FileError but that should not be processed until later in the process |
| 2259 | 2257 | // to allow for help, version and other errors to generate first. |
| 2260 | 2258 | _process_config_file(); |
| 2259 | + | |
| 2261 | 2260 | // process env shouldn't throw but no reason to process it if config generated an error |
| 2262 | 2261 | _process_env(); |
| 2263 | - } catch(const CLI::FileError &fe2) { | |
| 2264 | - fe = fe2; | |
| 2265 | - caught_error = true; | |
| 2262 | + } catch(const CLI::FileError &) { | |
| 2263 | + // callbacks and help_flags can generate exceptions which should take priority | |
| 2264 | + // over the config file error if one exists. | |
| 2265 | + _process_callbacks(); | |
| 2266 | + _process_help_flags(); | |
| 2267 | + throw; | |
| 2266 | 2268 | } |
| 2267 | - // callbacks and help_flags can generate exceptions which should take priority over the config file error if one | |
| 2268 | - // exists | |
| 2269 | + | |
| 2269 | 2270 | _process_callbacks(); |
| 2270 | 2271 | _process_help_flags(); |
| 2271 | 2272 | |
| 2272 | - if(caught_error) { | |
| 2273 | - throw CLI::FileError(std::move(fe)); | |
| 2274 | - } | |
| 2275 | - | |
| 2276 | 2273 | _process_requirements(); |
| 2277 | 2274 | } |
| 2278 | 2275 | ... | ... |