← Back to issue list

providers: improve error handling (CRAFT-472)

View original Github issue

Metadata

Project
charmcraft
Number
#504
Type
pull request
State
merged
Author
cjp256
Labels
Created
Updated
Closed

Current evaluation

Improved error handling for provider-generated exceptions by adding try/except blocks for LXD and Multipass, chaining exceptions, and adding test coverage. Merged after approval and passing CI checks.

Suggested action:

No scores available.

Issue body

- Ensure there is error handling for all provider-generated exceptions. Catch BaseConfigurationError when launching environments for LXD and Multipass and add missing try/except cases in LXD provider. - Ensure all exceptions are chained (and make sure the tests validate it) - Add test coverage for added exception handling. Signed-off-by: Chris Patterson <chris.patterson@canonical.com>

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Improved error handling for provider-generated exceptions by adding try/except blocks for LXD and Multipass, chaining exceptions, and adding test coverage. Merged after approval and passing CI checks.
qwen3.6-35b-a3b-mtp-q6 Merged improvements to provider error handling, adding BaseConfigurationError catching for LXD and Multipass, ensuring proper exception chaining, and adding test coverage. Resolves CRAFT-472.
qwen3.6-35b-a3b-mtp-q6 Merged. Improved error handling for provider-generated exceptions by adding missing try/except blocks for LXD and Multipass, ensuring proper exception chaining, and adding corresponding test coverage. Resolves CRAFT-472.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#484 providers: refactor to better support multiple providers (CRAFT-362) charmcraft merged Merged following two approvals and passing CI. Refactored the providers module into a package introducing a common Provider interface and LXDProvider subclass to accommodate future providers like Multipass. No behavioral changes. Minor naming adjustments applied during review.
80%
#3660 providers: integrate craft-providers support snapcraft merged Integrated craft-providers support to run lifecycle commands in LXD or Multipass build providers. Merged with 1338 additions and 41 deletions across 22 files, adapting Charmcraft's implementation after reviewer approval.
75%
#2647 build providers: catch LXD socket error snapcraft merged Merged to catch LXD socket errors in build providers, resolving SNAPCRAFT-WA. Approved by reviewer, passed CI checks, and integrated with a 14-line addition and 6-line deletion across three files. Minor test coverage decrease noted but did not block merge.
74%
#86 providers: use ProviderError from craft-providers rockcraft merged Merged adoption of ProviderError from craft-providers. Replaced custom error handling with centralized exceptions, added error catching, and included comprehensive tests. Approved and passed CI.
74%
#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.
73%
#419 providers: gracefully handle when LXD not installed (CRAFT-329) charmcraft merged Merged implementation for graceful LXD installation handling during build and clean operations. Introduces ensure_provider_is_available() and is_provider_available() interfaces to verify provider status before execution. Approved and passed CI.
72%
#9 providers: add build provider support (CRAFT-28) rockcraft merged Merged integration of rockcraft with craft-providers to run build providers on LXD instances. The change ports Charmcraft glue code, hardwires execution to LXD, and defers user messages and log retrieval to follow-up PRs. Approved and passed CI.
72%
#4032 requirements: update craft-providers to 1.7.2 snapcraft merged Merged dependency update to craft-providers 1.7.2. Resolves LXD instance ID map checking for core22 snaps, preventing dubious ownership errors when multiple users launch the same instance. Approved and passed CI.
71%
#4262 LXD errors from Craft Providers not properly presented snapcraft closed Closed. Fixed unhandled LXD installation errors that caused raw Python tracebacks. Updated Craft Providers to surface user-friendly error messages instead of stack traces.
71%
#403 build(deps): bump craft-providers to 1.19.2 rockcraft merged Merged bumping craft-providers to 1.19.2. Fixes LXD startup failures from base tag changes and enforces disk device requirements in the default LXD profile. Approved by two reviewers with passing CI.
71%