← 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 PR #1495 in commit f09ea712c, replacing exceptions raised from the CLI excepthook with direct traceback printing and an appropriate exit.

Resolution: closed resolved

Reason: PR #1495 was approved and merged as commit f09ea712c. It makes the CLI print tracebacks and exit instead of raising from sys.excepthook, avoiding Python's confusing secondary excepthook error.

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed resolved Merged PR #1495 in commit f09ea712c, replacing exceptions raised from the CLI excepthook with direct traceback printing and an appropriate exit.
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#1495 (f09ea712c): the CLI now prints tracebacks from sys.excepthook and exits appropriately instead of raising from the hook.
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#1495 (f09ea712c), replacing exceptions raised from sys.excepthook with direct traceback printing and an appropriate exit.
stealth/space-bunny-alpha — closed resolved Merged PR #1495 (commit f09ea712c), making sys.excepthook print tracebacks and exit appropriately instead of raising exceptions.
stealth/space-bunny-alpha — closed resolved Merged in canonical/snapcraft#1495 (commit f09ea712c), replacing exceptions raised from sys.excepthook with direct traceback printing and an appropriate exit.
stealth/space-bunny-alpha — closed resolved Merged CLI change to print tracebacks and exit directly instead of raising from sys.excepthook, avoiding Python's confusing "Error in sys.excepthook" output.
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.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#1436 cli: properly handle exceptions snapcraft merged Merged in commit be340e4f7, adding a global sys.excepthook for consistent CLI exception handling across store and future commands.
73%