← Back to issue list

errors: migrate handful of errors to SnapcraftException

View original Github issue

Metadata

Project
snapcraft
Number
#2752
Type
pull request
State
merged
Author
cjp256
Labels
Created
Updated
Closed

Current evaluation

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.

Suggested action:

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
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.
qwen3.6-35b-a3b-mtp-q6 Merged migration of several errors to SnapcraftException, adding SnapcraftReportableException. Simplified messages, updated resolution advice to clean the full project, and added tests. Included CLEAN_RESOLUTION constant.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2 errors: new module (CRAFT-839) craft-grammar merged Merged a new errors module imported from Snapcraft, updated for linter compliance, and accompanied by tests. Approved by one reviewer, passed CI, and modified four files with 106 additions and 19 deletions.
72%
#2739 tests: fix mypy error with test_errors.py snapcraft merged Merged a fix for a mypy error in test_errors.py where SnapcraftException.__init__ incorrectly returned a value. Approved, passed CI, and integrated with a single-line change.
72%
#1499 repo: make errors based on SnapcraftError snapcraft merged Merged a fix preventing repo-based errors from triggering tracebacks outside debug mode by inheriting from SnapcraftError. Approved by two reviewers, passed CI, and resolves an oversight from PR #1436.
71%
#2734 SnapcraftError refactoring snapcraft merged Refactored SnapcraftError across four files, adding 279 lines and removing 26. Approved by one reviewer and merged into the codebase.
71%
#47 packages: add snap-related exceptions craft-parts merged Added exception classes for snap handling errors to craft_parts.packages.snaps. Approved by two reviewers, passed CI checks, and merged with 163 additions and 18 deletions across two files.
70%