cli: properly handle exceptions in lifecycle
Metadata
Current evaluation
Superseded by PR #1436. The changes improved lifecycle CLI exception handling, displaying user-friendly messages for SnapcraftError and tracebacks for other exceptions based on debug mode.
Suggested action: —
No scores available.
Issue body
The exception handling proposed here:
When debug=False:
- If exception is a `SnapcraftError`, just display a nice error and exit 1.
- If exception is NOT a `SnapcraftError`, raise so traceback is shown.
When debug=True:
- Raise any exception so traceback is shown.
**Note:** This PR is limited to the lifecycle CLI, but the same logic should probably be applied to the store CLI in a separate PR.
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Superseded by PR #1436. The changes improved lifecycle CLI exception handling, displaying user-friendly messages for SnapcraftError and tracebacks for other exceptions based on debug mode. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed in favor of PR #1436. The lifecycle CLI exception handling logic was implemented via the superseding pull request, establishing consistent error reporting across the codebase. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Closed in favor of PR #1436. Exception handling improvements for the lifecycle CLI were superseded by a broader exception sweep implemented in the referenced pull request. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #1436 cli: properly handle exceptions | snapcraft | merged | Merged a global exception handler for CLI errors, superseding PR #1429. Replaced per-command decorators to simplify maintenance and auto-coverage. Fixed exit_code property test failures before merge. | |
| #3630 cli: add lifecycle command stubs (CRAFT-764) | snapcraft | merged | Merged into snapcraft/7.0. Added CLI stubs for pull, build, stage, and prime phases, falling back to legacy. Reorganized CLI tests and fixed version command tests. Approved and passed CI. |