← Back to issue list

Fix formatting of some store errors

View original Github issue

Metadata

Project
snapcraft
Number
#2056
Type
pull request
State
merged
Author
cjwatson
Labels
—
Created
Updated
Closed

Current evaluation

PR #2056 by cjwatson merged as commit 1f90b2a91, fixing store error messages that were pre-formatted with str.format so raw JSON braces no longer crash SnapcraftError.__str__ (LP: #1761488).

Resolution: closed resolved

Reason: The PR was approved and merged into snapcraft as commit 1f90b2a91 ("Fix formatting of some store errors (#2056)"), removing the double str.format in storeapi error fmt strings and adding tests covering StoreReviewError and StoreMetadataError.

Evaluated by: mr-cal-bot

No scores available.

Issue body

`SnapcraftError.fmt` is run through `str.format` by `SnapcraftError.__str__`, so it shouldn't itself be the output of a `str.format` operation. If it is, and the output contains `{}` (as for example if it contains raw JSON output), then `__str__` will raise an exception. LP: [#1761488](https://bugs.launchpad.net/bugs/1761488)

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved PR #2056 by cjwatson merged as commit 1f90b2a91, fixing store error messages that were pre-formatted with str.format so raw JSON braces no longer crash SnapcraftError.__str__ (LP: #1761488).
stealth/space-bunny-alpha — closed resolved Merged as commit 1f90b2a91. Store error messages were preformatted with str.format, so raw JSON braces in them made SnapcraftError.__str__ raise. Rebased after #2050 landed and extended with tests for StoreReviewError/StoreMetadataError; fixes LP bug #1761488.
stealth/space-bunny-alpha — closed resolved Merged as commit 1f90b2a91 (#2056), fixing store errors whose preformatted messages, including raw JSON braces, crashed SnapcraftError.__str__; added StoreReviewError and StoreMetadataError tests.
qwen/qwen3.6-35b-a3b — — Merged after PR #2050 landed first. Fixed SnapcraftError formatting that crashed __str__ on pre-formatted strings with braces. Author rebased and added tests for StoreReviewError and StoreMetadataError fixes. Approved and passed CI.
qwen3.6-35b-a3b-mtp-q6 — — Merged. Fixed a bug where pre-formatted SnapcraftError.fmt strings with braces caused exceptions. Overlapped with PR #2050; after it merged, the author rebased this PR, added tests for related store errors, and it was merged.

Update history

No update history recorded yet.

Related work

Related issues

Issue Project State Summary Similarity
#4863 fix(cli): properly capture store errors snapcraft merged Merged #4863 in commit 426df7ec3, restoring legacy-style store-error capture so store failures are no longer reported as Snapcraft internal errors.
75%
#1664716 store error list is ugly snapcraft (launchpad) closed Store error formatting improved in CLI. Resolved by error handling updates (e.g. PR #2056, commit 1f90b2a91). Maintainer confirmed Snapcraft now presents these errors better.
74%
#585 Improve the store errors returning exceptions snapcraft merged Merged in canonical/snapcraft#585 via commit ddbbdbd06, refactoring store error handling to raise exceptions and addressing LP #1594636.
74%
#1627865 Snapcraft errors when releasing a snap snapcraft (launchpad) closed Resolved by improving snapcraft's error handling to check HTTP status codes before JSON decoding, alongside a fix for the underlying store race condition (bug #1610948).
71%