Suppress verbose tracebacks by default, show only with -vv#852
Draft
Suppress verbose tracebacks by default, show only with -vv#852
Conversation
Install a custom sys.excepthook in the fre() entry point that suppresses Python tracebacks at default and -v verbosity levels. At -vv (DEBUG), the full traceback is shown. At lower levels, only the exception type and message are printed, along with a hint to use 'fre -vv ...' for more detail. Closes #793 Agent-Logs-Url: https://github.com/NOAA-GFDL/fre-cli/sessions/d594a572-8566-467b-9a96-4b233d712582 Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
Agent-Logs-Url: https://github.com/NOAA-GFDL/fre-cli/sessions/d594a572-8566-467b-9a96-4b233d712582 Co-authored-by: ilaflott <6273252+ilaflott@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Refactor error messages for clarity
Suppress verbose tracebacks by default, show only with -vv
Apr 9, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #852 +/- ##
==========================================
- Coverage 84.12% 84.10% -0.03%
==========================================
Files 71 71
Lines 4944 4950 +6
==========================================
+ Hits 4159 4163 +4
- Misses 785 787 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
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.
Describe your changes
Unhandled exceptions currently dump full Python stack traces, burying the actual error message in noise. This installs a custom
sys.excepthookin thefre()entry point that shows only the error type and message at default/-vverbosity, with a hint to use-vvfor the full traceback.Before (default):
After (default):
After (
fre -vv): full traceback, same as current behavior.Changes:
fre/fre.py: Setsys.excepthookto a brief formatter whenlog_level > DEBUG. Updated-vhelp text.fre/tests/test_fre_cli.py: Three subprocess-based tests covering default,-v, and-vvtraceback behavior.docs/tools.rst: Document traceback suppression under the-v[v]flag.Issue ticket number and link (if applicable)
Checklist before requesting a review