← Back to issue list

cli: properly handle exceptions in lifecycle

View original Github issue

Metadata

Project
snapcraft
Number
#1429
Type
pull request
State
closed
Author
kyrofa
Labels
—
Created
Updated
Closed

Current evaluation

Closed in favor of #1436, which implemented global CLI exception handling and merged as commit be340e4f7.

Resolution: closed superseded

Reason: Maintainer sergiusens closed #1429 in favor of #1436. The replacement PR added global exception handling across the CLI and merged in commit be340e4f7.

Evaluated by: mr-cal-bot

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
stealth/space-bunny-alpha — closed superseded Closed in favor of #1436, which implemented global CLI exception handling and merged as commit be340e4f7.
stealth/space-bunny-alpha — closed superseded Closed in favor of #1436, which generalized lifecycle exception handling into a global CLI handler and merged as commit be340e4f7.
stealth/space-bunny-alpha — closed superseded Superseded by #1436, which merged global CLI exception handling after #1429 was closed in its favour.
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.

Update history

No update history recorded yet.

Related work

  • Superseded By: canonical/snapcraft#1436 (confidence 100%)

    #1436 replaced the lifecycle-only approach with a broader global CLI exception handler and was merged.

Related issues

Issue Project State Summary Similarity
#1436 cli: properly handle exceptions snapcraft merged Merged in commit be340e4f7, adding a global sys.excepthook for consistent CLI exception handling across store and future commands.
77%
#1347 cli: do not duplicate errors snapcraft merged Merged as commit 9e8e336de, PR #1347 eliminated duplicate CLI validation errors and refactored error handling to prevent recurrence.
72%
#1790 cli: include consistent commands to fix error conditions snapcraft merged Merged PR #1790 at b78dbda8, standardizing corrective commands in CLI error messages and closing #1733; prerequisite #1640 added richer common-error guidance.
71%