← Back to issue list

cli: don't raise from excepthook

View original Github issue

Metadata

Project
snapcraft
Number
#1495
Type
pull request
State
merged
Author
kyrofa
Labels
Created
Updated
Closed

Current evaluation

Merged a fix to prevent raising exceptions in the CLI excepthook, which caused confusing Python error messages. The change manually prints tracebacks and exits cleanly. Approved by two reviewers and passed CI.

Suggested action:

No scores available.

Issue body

Raising exceptions from `excepthook` does not seem to be expected by Python, causing it to print "Error in sys.excepthook: [...]" which may look a little confusing, as the `excepthook` has nothing to do with the error. Instead of raising again and relying on Python to further handle the exception, print the traceback ourselves and exit appropriately.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged a fix to prevent raising exceptions in the CLI excepthook, which caused confusing Python error messages. The change manually prints tracebacks and exits cleanly. Approved by two reviewers and passed CI.
qwen3.6-35b-a3b-mtp-q6 Merged a CLI update that stops raising exceptions in the excepthook, preventing confusing Python error messages. The handler now prints the traceback directly and exits cleanly.
qwen3.6-35b-a3b-mtp-q6 Merged CLI exception handling fix that prevents raising exceptions in sys.excepthook. The code now prints the traceback directly and exits cleanly, eliminating confusing Python error messages.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1436 cli: properly handle exceptions snapcraft merged Merged a global exception handler for CLI errors, superseding PR #1429. Replaced per-command decorators to simplify maintenance and auto-coverage. Fixed exit_code property test failures before merge.
71%
#3125 cli: cleanup error handling snapcraft merged Merged CLI error handling cleanup. Removed legacy try/except block for Ubuntu 16.04 and switched to inline type hints to eliminate noqa comments. Approved by reviewer and passed CI checks.
70%