hud-python icon indicating copy to clipboard operation
hud-python copied to clipboard

Fix: narrow JSON parse try-blocks and added guards

Open rachel-ux opened this issue 7 months ago • 0 comments

[!NOTE] Low Risk Low risk: changes only harden JSON parsing/error-message construction and should reduce false positives/crashes, with minimal behavior change aside from skipping non-dict JSON payloads.

Overview Tightens JSON parsing in find_reward and find_content to only wrap json.loads in the try, then skips invalid JSON or non-dict payloads before scanning for accepted keys.

Refactors HudRequestError.from_httpx_error to parse response.json() into a temporary value, only treat dict JSON as structured error data, and consistently build the fallback message while optionally appending small JSON responses.

Reviewed by Cursor Bugbot for commit 84213217c19270c8228c64f96f5f88656b7375d4. Bugbot is set up for automated code reviews on this repo. Configure here.

rachel-ux avatar Apr 27 '26 18:04 rachel-ux