From 6bfc2d5ca3fd8b78f14fa2e63a791915bae7647d Mon Sep 17 00:00:00 2001 From: WaefreBeorn Date: Mon, 25 May 2026 10:03:28 -0400 Subject: [PATCH] fix: narrow bare except to specific json exceptions in mcp_integration (F23) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Changed 'except Exception: pass' to 'except (json.JSONDecodeError, AttributeError, TypeError):' with explanatory comment - Intentional fallback: if HTTP response body isn't parseable JSON, use generic error string from the exception Closes F23 — rent_a_relic/mcp_integration.py bare pass gap --- tools/rent_a_relic/mcp_integration.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/rent_a_relic/mcp_integration.py b/tools/rent_a_relic/mcp_integration.py index 67eb6cfd2..517ba3af7 100644 --- a/tools/rent_a_relic/mcp_integration.py +++ b/tools/rent_a_relic/mcp_integration.py @@ -212,7 +212,8 @@ def _handle_reserve(self, msg: dict, beacon_id: str) -> dict: body = {} try: body = _response_json_object(exc.response) - except Exception: + except (json.JSONDecodeError, AttributeError, TypeError): + # Response body isn't valid JSON — fall back to generic error string pass return self._error_response(beacon_id, body.get("error", str(exc)))