clang-tidy: resolve bugprone-exception-escape#491
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Wraps main() bodies in function-try-blocks to prevent exceptions from escaping main, addressing clang-tidy’s bugprone-exception-escape warnings in the app and a couple of test executables.
Changes:
- Convert
main()definitions to function-try-blocks withcatch (std::exception const&)andcatch (...). - Emit error messages to
std::cerrand return non-zero on uncaught exceptions. - Add
<iostream>include where needed for newstd::cerrusage.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
test/memory-checks/many_events.cpp |
Adds top-level exception handling in main() and prints failures to stderr. |
test/form/form_root_schema_read_test.cpp |
Adds top-level exception handling in main() for schema evolution test executable. |
phlex/app/phlex.cpp |
Adds a top-level function-try-block around the CLI/application entry point to prevent exception escape. |
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #491 +/- ##
==========================================
+ Coverage 85.49% 85.52% +0.02%
==========================================
Files 142 142
Lines 3586 3586
Branches 615 615
==========================================
+ Hits 3066 3067 +1
Misses 311 311
+ Partials 209 208 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 3 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Copilot
AI
changed the title
Resolve
Resolve Apr 8, 2026
bugprone-exception-escape clang-tidy issuesbugprone-exception-escape clang-tidy warnings
bugprone-exception-escape clang-tidy warningsclang-tidy: resolve bugprone-exception-escape
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…ession Agent-Logs-Url: https://github.com/Framework-R-D/phlex/sessions/baa4904f-0467-4878-bde2-a47c1a5e0bdc Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Agent-Logs-Url: https://github.com/Framework-R-D/phlex/sessions/baa4904f-0467-4878-bde2-a47c1a5e0bdc Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
54d4d66 to
135e530
Compare
knoepfel
approved these changes
Apr 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
clang-tidyflagsmain()functions that can propagate uncaught exceptions asbugprone-exception-escape. This addresses those warnings across the app and two test executables.Changes
phlex/app/phlex.cpp— Suppresses the warning withNOLINTNEXTLINE(bugprone-exception-escape)rather than wrappingmainin a function-try-block. The existing inner try/catch blocks (aroundbpocommand-line parsing andphlex::experimental::run()) already handle the relevant throw sites; an outer catch would only duplicate handling inconsistently.test/memory-checks/many_events.cppandtest/form/form_root_schema_read_test.cpp— Wrapsmain()in a function-try-block catchingstd::exception const&and..., printing tostd::cerrand returning non-zero on unhandled exceptions.