errors: migrate handful of errors to SnapcraftException
Metadata
Current evaluation
Merged as be725892c: added SnapcraftReportableException, converted MissingStateClean, StepOutdatedError, SnapcraftEnvironmentError, SnapcraftDataDirectoryMissingError and SnapcraftMissingLinkerInBaseError to SnapcraftException, shortening messages and updating tests.
Resolution: closed resolved
Reason: The PR was approved and merged into snapcraft as commit be725892c, adding a SnapcraftReportableException helper (overriding get_reportable()) and migrating the listed errors with simplified messages/resolutions; tests were updated to assert reportable values.
Evaluated by: mr-cal-bot
No scores available.
Issue body
- Add SnapcraftReportableException helper class for reportable
errors, which simply flips the default value for get_reportable().
- Convert MissingStateClean, StepOutdatedError,
SnapcraftEnvironmentError, SnapcraftDataDirectoryMissingError,
and SnapcraftMissingLinkerInBaseError and associated tests.
- Add missing test for SnapcraftDataDirectoryMissingError.
- Update tests to verify expected "reportable" value as well.
The error messages are being shortened and I am also using
this opportunity to simplify them (and the resolution messages).
For example, when StepOutdatedError occurs, instead of suggesting
that the user clean just one part/step when something is out of date,
ask them to instead clean the whole project. Something unusual has
happened and it's probably a good idea to clean the whole tree.
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [ ] 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 as be725892c: added SnapcraftReportableException, converted MissingStateClean, StepOutdatedError, SnapcraftEnvironmentError, SnapcraftDataDirectoryMissingError and SnapcraftMissingLinkerInBaseError to SnapcraftException, shortening messages and updating tests. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged as be725892c: added SnapcraftReportableException, migrated several errors, simplified messages and resolutions, and updated tests. | |
| qwen/qwen3.6-35b-a3b | — | — | Merged. Migrates multiple error classes to SnapcraftException, adds a SnapcraftReportableException helper, simplifies error messages, and updates tests. Approved by a maintainer and passed CI checks. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged migration of several errors to SnapcraftException and added SnapcraftReportableException. Simplified messages, updated resolution advice to recommend full project cleaning, and adjusted tests. Final commit added a CLEAN_RESOLUTION constant and fixed StepOutdatedError. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #2602 errors: refactor exception/error handling | snapcraft | merged | 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. | |
| #47 packages: add snap-related exceptions | craft-parts | merged | Merged craft-parts#47 via commit 63183278, adding dedicated exception classes for snap-handling errors used by craft_parts.packages.snaps. | |
| #2635 Legacy errors | snapcraft | merged | Merged in snapcore/snapcraft#2635, improving legacy error reports by showing the underlying HTTP error and adding a View option to the reporting prompt. |