store: do not unnecessarily catch/rewrite exceptions
Metadata
Current evaluation
Merged into master. Removes unnecessary exception handling in store module login functions to surface original errors for debugging. Drops unused error constants and updates tests. Approved with passing CI and 100% diff coverage.
Suggested action: —
No scores available.
Issue body
The exceptions may have information that is necessary to
debug:
- _try_login() unnecessarily caught a few exceptions, calling
failed_login() to report them. Instead, just surface the
applicable exceptions (which have similar error messages).
- Similarily, drop _requires_login() wrapper which also
unnecessarily caught storeapi.errors.InvalidCredentialsError and
raised an identical error message.
- Update tests, dropping a few duplicate test cases.
- Remove unneeded AUTHENTICATION_ERROR, and now-unneeded
INVALID_CREDENTIALS and ACCOUNT_INFORMATION_ERROR constants.
Signed-off-by: Chris Patterson <chris.patterson@canonical.com>
- [ ] Have you followed the [guidelines for contributing](https://github.com/snapcore/snapcraft/blob/master/CONTRIBUTING.md)?
- [ ] Have you signed the [CLA](http://www.ubuntu.com/legal/contributors/)?
- [ ] Have you successfully run `./runtests.sh static`?
- [ ] Have you successfully run `./runtests.sh tests/unit`?
-----
Evaluation history
| Date | Model | Scores | Action | Summary |
|---|---|---|---|---|
| qwen/qwen3.6-35b-a3b | — | — | Merged into master. Removes unnecessary exception handling in store module login functions to surface original errors for debugging. Drops unused error constants and updates tests. Approved with passing CI and 100% diff coverage. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged into master. Removed redundant exception handling in store module login functions to preserve original error details. Deleted unused error constants and redundant tests. Code coverage stable with 100% diff coverage. | |
| qwen3.6-35b-a3b-mtp-q6 | — | — | Merged to master. Refactored store login functions to stop unnecessarily catching and rewriting exceptions, preserving debugging details. Updated tests and removed unused error constants. |
Update history
No update history recorded yet.
Related issues
| Issue | Project | State | Summary | Similarity |
|---|---|---|---|---|
| #3808 store: login requires no exported credentials | snapcraft | merged | Merged into main following reviewer approval and passing CI. The update modifies store login to require no exported credentials, changing 3 files (+29/-4 lines). Code coverage increased by 0.01% with 100% diff coverage. | |
| #670 errors: catch all CraftStoreErrors (CRAFT-813) | charmcraft | merged | Merged. Catches all CraftStoreErrors during craft_store library initialization. Approved by one reviewer with passing CI checks across 5 files (+35/-30). | |
| #1055 store: proper error colors for login failures. | snapcraft | merged | Merged implementation of proper error colors for login failures in the store module. Approved by one reviewer with zero unresolved comments. The two-line change maintains 96.36% code coverage and resolves LP #1610847. | |
| #585 Improve the store errors returning exceptions | snapcraft | merged | Merged changes improving store error handling by returning exceptions. Approved by maintainer come-maiz following multiple retest requests. Modifies 5 files with 93 additions and 61 deletions. |