feat: many improvements to error handling/reporting
Metadata
Current evaluation
Merged after resolving a craft-cli dependency. Adds error handling improvements: standard exceptions, normalized validation messages, BuildPlanner updates, and doc URLs. Approved by two reviewers and passed CI.
Suggested action: —
No scores available.
Issue body
This PR contains multiple "small" improvements/fixes related to error handling and reporting. Each change is in a separate commit. They are:
- Set craft-cli dep to the temporary "rockcraft" working branch;
- Stop raising `CraftValidationError` from validators - raise ValueError, TypeError, etc instead;
- Normalize validation error messages so that they have a more consistent presentation;
- Use `from_yaml_data()` in the BuildPlanner so that error translation/prettifying happens;
- Set docs url and slugs for validation errors in CraftBaseModels.
The PR is currently failing because it needs https://github.com/canonical/craft-cli/pull/257
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged after resolving a craft-cli dependency. Adds error handling improvements: standard exceptions, normalized validation messages, BuildPlanner updates, and doc URLs. Approved by two reviewers and passed CI. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged error handling improvements: validators now raise standard exceptions, validation messages are normalized, and YAML error translation is enhanced. Required craft-cli#257 to pass CI checks before merging. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #591 Revisited all error usage to adapt to new craft-cli context. | charmcraft | merged | Merged after approval and CI. Updated error handling for craft-cli by using from err for subprocess errors, adding details attributes, adjusting Store return codes, and transforming StoreServerError. Changed 8 files. | |
| #264 feat: add CraftCommandError | craft-cli | merged | Merged implementation of CraftCommandError class with a stderr attribute for command output. Approved by two reviewers, passed CI checks, and resolves issue #260 across seven files. | |
| #706 fix: improve the handling of platforms errors. | craft-application | merged | Merged fix for platform error handling. Approved by two reviewers with all CI checks passing. Resolves issue #690 and CRAFT-4369/4370. Modifies eight files with 98 additions and 239 deletions. | |
| #4295 cli: catch craft-provider errors | snapcraft | merged | Merged after approval, adding CLI error handling for craft-provider failures. Resolves #4262 and CRAFT-1898. Passed CI checks and achieved 100% diff coverage across two modified files. | |
| #2186 docs: fix build errors | charmcraft | merged | Merged a one-line documentation fix to resolve recent build errors. Approved by two reviewers. Remaining build issues were subsequently addressed in craft-parts pull request 1021. | |
| #2070 docs: fix build errors in craft-parts | charmcraft | closed | Merged to resolve documentation build errors in craft-parts. Changes fix ref and label issues, with some dependencies on an upstream PR. Integrated directly by the maintainer without reviewer comments or CI checks. | |
| #485 Update to craft-application@main | rockcraft | merged | Merged update to craft-application@main, implementing BuildPlanner changes and pruning obsolete code across 16 files. Approved by one reviewer with passing CI checks. | |
| #634 feat: use versioned form of doc urls | rockcraft | merged | Merged. Updates documentation URLs in error messages and rockcraft init templates to use versioned paths. Approved by two reviewers, passed CI, and modified eight files. | |
| #495 feat: add craft-platforms compatibility methods | craft-application | merged | Merged after approval by two reviewers and passing CI checks. Added craft-platforms compatibility methods and deprecation warnings. Documentation breakage was later resolved in PR #498. |