← Back to issue list

storeapi: handle errors even for >400 responses

View original Github issue

Metadata

Project
snapcraft
Number
#1936
Type
pull request
State
merged
Author
kyrofa
Labels
Created
Updated
Closed

Current evaluation

Merged PR resolves Launchpad bug #1736963 by fixing storeapi error handling for HTTP responses over 400. Bypasses the requests library __bool__ quirk to ensure proper error messages display for failed API calls. Approved and passed CI.

Suggested action:

No scores available.

Issue body

- [x] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)? - [x] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)? - [x] If this is a bugfix. Have you checked that there is a bug report open for the issue you are trying to fix on [bug reports](https://bugs.launchpad.net/snapcraft)? - [x] If this is a new feature. Have you discussed the design on the [forum](https://forum.snapcraft.io)? - [x] Have you successfully run `./runtests.sh static`? - [x] Have you successfully run `./runtests.sh unit`? ----- This PR resolves LP: [#1736963](https://bugs.launchpad.net/snapcraft/+bug/1736963) by showing proper error messages even for responses with error return codes. The requests lib's Response object overwrites __bool__ to return false if the response code indicates a failure. As a result, if we want to see if a response is actually `None` as must compare directly to `None`. Or just make a call and catch a missing attribute which is what we do here.

Evaluation history

Date Model Scores Action Summary
qwen/qwen3.6-35b-a3b Merged PR resolves Launchpad bug #1736963 by fixing storeapi error handling for HTTP responses over 400. Bypasses the requests library __bool__ quirk to ensure proper error messages display for failed API calls. Approved and passed CI.
qwen3.6-35b-a3b-mtp-q6 Merged fix for store API error handling. Adjusted requests library response evaluation to properly display error messages for HTTP status codes above 400, resolving Launchpad bug #1736963.
qwen3.6-35b-a3b-mtp-q6 Merged fix for handling HTTP error responses with status codes above 400. Resolves Launchpad bug #1736963 by correcting boolean evaluation of the requests Response object, ensuring proper error messages are returned instead of failing silently.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#2116 storeapi: handle 5xx error codes for all store endpoints snapcraft merged Merged robust 5xx error handling across all store API endpoints. Fixes Launchpad bug #1768370 by generalizing release-specific error handling. Approved by two reviewers and passed CI checks.
82%
#2094 storeapi: better handle network errors and retries snapcraft merged Resolves Launchpad bug #1765671 by improving storeapi network error handling. Sets urllib log level to ERROR and properly manages max retry failures, eliminating verbose warnings and tracebacks. Approved and merged after passing CI.
82%
#2059 storeapi: handle 500 error response when releasing snap snapcraft merged Merged fix that properly handles 500 HTML error responses from the store during snap release. Adds debug logging for store errors to streamline future troubleshooting. Approved by reviewer and passed CI checks.
74%
#3550 storeapi: log responses and registration error code snapcraft merged Merged. Adds debug logging for store API responses and improves registration error code output. The minimal change (+16/-5 lines, 4 files) passed CI, achieved 100% coverage, and was approved for backporting.
71%
#3667 storeapi: fix typo snapcraft merged Merged a single-line typo correction in the storeapi module. Approved by a reviewer, passed CI, and increased test coverage by 0.07%.
70%