[Bot] QuestBoardApiError should refuse a first argument that is not a response #522
Loading…
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?
Found while rebasing v4.3.0 phase 5 lane A over lane B (#373).
QuestBoardApiError.__init__(response, detail)inbot/questboard_bot/api_client.pyreadsgetattr(response, "status_code", 0), so a caller that passes a string (or anything else) asresponsegets an error object withstatus_code == 0anddetail == "", whichuser_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 bitVotingClosedErrorduring the rebase: the test caught it, but only because one existed for that path.Fix: raise
TypeErrorwhenresponsehas nostatus_code, so a wrong-shaped raise fails loudly in tests instead of producing misleading copy in a channel. One guard, one test.