Optimize WARNING_QUIT fatal-exit output#7413
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates error-exit handling to present failures as ERROR (instead of NOTICE) and adjusts WARNING_QUIT to skip timer/statistics output on error exits.
Changes:
- Refactors common quit logic into a new
quit_impl(ret, print_timer)helper. - Changes quit banner text from
NOTICEtoERRORand updates multiple tests accordingly. - Updates unit tests to assert error visibility and absence of timer output for
WARNING_QUIT.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| source/source_basis/module_pw/test/test-other.cpp | Updates expected quit output substring to ERROR. |
| source/source_base/tool_quit.cpp | Introduces quit_impl, changes quit banners to !ERROR!, and skips timer output for WARNING_QUIT. |
| source/source_base/test/tool_quit_test.cpp | Updates expectations to look for ERROR and ensure timer stats are not printed on error exits. |
| source/source_base/test/tool_check_test.cpp | Updates expected quit output substring to ERROR. |
| source/source_base/test/math_chebyshev_test.cpp | Updates expected quit output substring to ERROR. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| std::string g_quit_out_dir; | ||
| std::string g_quit_calculation; | ||
|
|
||
| [[noreturn]] void quit_impl(const int ret, const bool print_timer) |
There was a problem hiding this comment.
We recommend keeping the C++ syntax simple: just use void and avoid adding new syntax elements.
|
|
||
| std::cout << " ---------------------------------------------------------" << std::endl; | ||
| std::cout << " !NOTICE! " << std::endl; | ||
| std::cout << " !ERROR! " << std::endl; |
There was a problem hiding this comment.
This is not always an error. We intentionally set the log level to NOTICE.
|
We prefer not to change NOTICE to ERROR. Psychologically speaking, ERROR is treated as a fault indicator, which may lead users to assume the problem stems from their own operations and create negative psychological implications. |
|
We output timing data specifically to help find related errors. |
|
This change targets core code. We have thought it through carefully. For similar questions, please raise an issue first. |
|
Thanks for the clarification. I now understand that the However, I still have doubt whether timing data is the best way to help users locate the cause of a |
This PR makes
WARNING_QUIToutput better match its behavior.WARNING_QUITexits with a non-zero status, so the screen banner is changed fromNOTICEtoERROR. It also no longer printsTIME STATISTICSafter the fatal message, keeping the actual error easier to find in failed runs.Normal
QUIT()behavior is unchanged.