errors: refactor exception/error handling
Metadata
Current evaluation
Merged PR #2602 (commit 7d0391dc5, 'errors: refactor exception/error handling') reworked snapcraft/_errors.py: always print exception messages, conditionally write tracebacks to a temp file, gate bug reporting on SNAPCRAFT_ENABLE_SILENT_REPORT, and honor error exit codes.
Resolution: closed resolved
Reason: The PR itself was merged into master as commit 7d0391dc5 by maintainer cjp256, satisfying the agreed rules of engagement for exception/error handling; unit tests were updated in the same commit and later release notes (snapcraft-8-11.rst) document the follow-on removal of SNAPCRAFT_ENABLE_SILENT_REPORT.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- Ensure that exception message is _always_ printed.
- Tweak rules of engagement
- Print exception message (always)
- Capture trace in temporary file and print path, conditionally if:
(1) Exception is SnapcraftReportableError or
(2) Exception is non-Snapcraft error
(3) debug is true
- Automatically send bug report if:
(1) SNAPCRAFT_ENABLE_SILENT_REPORT=y
(2) "Always" send has been previously set.
- Prompt to send bug report, conditionally if connected to TTY and:
(1) Exception is SnapcraftReportableError or
(2) Exception is non-Snapcraft error
- Print trace, conditionally if:
(1) debug is true, or
(2) Reportable (see above) and either:
(a) no TTY
(b) not running as snap
- Use exit code from snapcraft error (if available), otherwise 1.
- Fixup unit tests to comply with changes.
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2602 (commit 7d0391dc5, 'errors: refactor exception/error handling') reworked snapcraft/_errors.py: always print exception messages, conditionally write tracebacks to a temp file, gate bug reporting on SNAPCRAFT_ENABLE_SILENT_REPORT, and honor error exit codes. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #2602 refactored exception handling to always print messages, conditionally handle tracebacks and bug reports, honor error exit codes, and update unit tests. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged in PR #2602, refactoring exception handling so messages always print; traceback capture, bug reporting, prompts, debug behavior, and exit codes follow new error and environment rules. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged exception handling refactor. Messages are always printed. Trace capture and bug prompts are conditional on error type, debug flags, and TTY. Exit codes updated, tests fixed. Approved and merged. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged refactoring of exception handling. Ensures messages always print, adds conditional trace capture and bug report prompts, fixes exit codes, and updates tests. Successfully merged after rebasing and resolving unrelated test failures. |
Update history
No update history recorded yet.
Related work
-
Related To:
canonical/snapcraft#2603
(confidence 70%)
Author noted the PR included a commit from #2603 to satisfy static checks.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2752 errors: migrate handful of errors to SnapcraftException | snapcraft | merged | Merged as be725892c: added SnapcraftReportableException, converted MissingStateClean, StepOutdatedError, SnapcraftEnvironmentError, SnapcraftDataDirectoryMissingError and SnapcraftMissingLinkerInBaseError to SnapcraftException, shortening messages and updating tests. | |
| #1499 repo: make errors based on SnapcraftError | snapcraft | merged | Merged PR #1499 in commit 827d7fd82, making repo errors inherit SnapcraftError so non-debug runs report handled errors instead of tracebacks. | |
| #2242 Error communication improvements | snapcraft | merged | Merged in #2242 via commit 4cdf0c6c2, printing tracebacks when Raven is unavailable and clarifying that internal errors should be reported to Snapcraft. | |
| #2187 errors: enable sentry by default | snapcraft | merged | Merged PR #2187 in commit f77a6c10a, enabling Sentry error reporting by default and adding SNAPCRAFT_ENABLE_SILENT_REPORTS for prompt-free reports. | |
| #591 Improve error reporting | snapcraft | merged | Merged PR #591 as commit b9258ea73, making errors log before exit status 1 and adding a clear error for uploads of nonexistent snaps. |