mirror of
https://github.com/Glitchy-Sheep/boosty-downloader.git
synced 2026-10-14 21:33:23 +00:00
[PR #112] [MERGED] [boosty-api] Fix wrong-username errors and non-JSON body crash #117
Labels
No labels
api-drift
bug
ci
documentation
enhancement
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Glitchy-Sheep/boosty-downloader#117
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Glitchy-Sheep/boosty-downloader/pull/112
Author: @Glitchy-Sheep
Created: 8/7/2026
Status: ✅ Merged
Merged: 8/7/2026
Merged by: @Glitchy-Sheep
Base:
main← Head:fix/api-error-mapping📝 Commits (2)
5781e39fix: 🐛 Map Boosty API errors before parsing the body (#94)76dd39btest: ✅ Add regression tests for API client error mapping📊 Changes
5 files changed (+168 additions, -4 deletions)
View changed files
📝
CHANGELOG.md(+1 -0)📝
boosty_downloader/main.py(+12 -2)📝
boosty_downloader/src/infrastructure/boosty_api/core/client.py(+24 -2)➕
test/unit/boosty_api/__init__.py(+0 -0)➕
test/unit/boosty_api/client_test.py(+131 -0)📄 Description
Summary
Wrong usernames now get clear messages instead of a scary "report this at GitHub" error, and a non-JSON reply from the API no longer crashes the app. Fixes #94.
Problem
invalid_param) fell into the generic "Unknown error occurred, please report this at GitHub issues" - that is how #94 was bornFix
BoostyAPIInvalidUsernameErrorfor 400 with its own message for the email caseBoostyAPIUnknownErrorBefore / After
Before:
download -u someone@gmail.comends with "Unknown error occurred, please report this at GitHub issues".After: it says "'someone@gmail.com' is not a valid username. Use the blog name from the author page URL (boosty.to/<username>), not an email".
Tests
test_404_maps_to_no_username_error_without_parsing_body- 404 gives "author not found" and the body is never parsedtest_401_maps_to_unauthorized_error_without_parsing_body- expired tokens keep the "relogin" messagetest_400_maps_to_invalid_username_error_without_parsing_body- the email case from #94test_unexpected_status_maps_to_unknown_error- 5xx with an HTML body no longer crashestest_200_with_non_json_body_maps_to_unknown_error- wrong content-type and broken JSON on 200 map to a clear errortest_200_with_valid_empty_page_returns_posts_response- the happy path still parsesNotes
invalid_param, 404blog_not_found) checked by hand against the live API🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.