storeapi: handle errors even for >400 responses
Metadata
Current evaluation
Merged PR #1936 (688588a0d) fixed Store API error handling for HTTP responses above 400, preventing failed responses from being mistaken for missing responses.
Resolution: closed resolved
Reason: PR #1936 was merged as commit 688588a0d. It changed Store API handling to inspect failed Requests responses directly, ensuring proper error reporting and resolving LP #1736963.
Evaluated by: mr-cal-bot
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 |
|---|---|---|---|---|
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1936 (688588a0d) fixed Store API error handling for HTTP responses above 400, preventing failed responses from being mistaken for missing responses. | |
| stealth/space-bunny-alpha | — | closed resolved | Merged PR #1936 (commit 688588a0d) fixed storeapi error handling for HTTP responses above 400, resolving LP #1736963. | |
| 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. |
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 PR #2116 as commit c6500ca0e, generalizing Store API 5xx handling across all endpoints and fixing LP #1768370. | |
| #2094 storeapi: better handle network errors and retries | snapcraft | merged | Merged #2094 as 0d8602cc5, silencing urllib retry warnings and handling Store API connection failure after retry exhaustion without a traceback; fixes LP #1765671. | |
| #3550 storeapi: log responses and registration error code | snapcraft | merged | Merged #3550 via 29dd2455d, adding debug logging for Store API responses and surfacing registration error codes. | |
| #2059 storeapi: handle 500 error response when releasing snap | snapcraft | merged | Merged PR #2059 via commit 3a861f74c fixed snap release handling of HTML 500 responses, added debug output for store errors, and resolved #2028. | |
| #2749 storeapi: add StoreErrorList to handle store errors | snapcraft | merged | Merged in #2749 via commit ac2d48293, adding StoreErrorList and improving StorePushError handling for resource-not-found and resource-forbidden responses. |