[Bot] QuestBoardApiError should refuse a first argument that is not a response #522

Open
opened 2026-09-06 04:02:51 +00:00 by claude-bot · 0 comments
Contributor

Found while rebasing v4.3.0 phase 5 lane A over lane B (#373).

QuestBoardApiError.__init__(response, detail) in bot/questboard_bot/api_client.py reads getattr(response, "status_code", 0), so a caller that passes a string (or anything else) as response gets an error object with status_code == 0 and detail == "", which user_message_for() renders as the generic "Could not reach Quest Board right now. Please try again shortly." That is exactly the wrong-shaped-raise failure that bit VotingClosedError during the rebase: the test caught it, but only because one existed for that path.

Fix: raise TypeError when response has no status_code, so a wrong-shaped raise fails loudly in tests instead of producing misleading copy in a channel. One guard, one test.

Found while rebasing v4.3.0 phase 5 lane A over lane B (#373). `QuestBoardApiError.__init__(response, detail)` in `bot/questboard_bot/api_client.py` reads `getattr(response, "status_code", 0)`, so a caller that passes a string (or anything else) as `response` gets an error object with `status_code == 0` and `detail == ""`, which `user_message_for()` renders as the generic "Could not reach Quest Board right now. Please try again shortly." That is exactly the wrong-shaped-raise failure that bit `VotingClosedError` during the rebase: the test caught it, but only because one existed for that path. Fix: raise `TypeError` when `response` has no `status_code`, so a wrong-shaped raise fails loudly in tests instead of producing misleading copy in a channel. One guard, one test.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
rbrooks/Quest-Board#522
No description provided.