From 87063ae5b35d66eacc2ca581346db9bb3fbf2b22 Mon Sep 17 00:00:00 2001 From: Jon Parise Date: Wed, 1 Apr 2026 11:17:19 -0400 Subject: [PATCH] Remove redundant ValueError catching JSONDecodeError is a ValueError. --- instaparser/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/instaparser/client.py b/instaparser/client.py index 6ea9a98..2fd88ba 100644 --- a/instaparser/client.py +++ b/instaparser/client.py @@ -79,7 +79,7 @@ def _map_http_error(e: HTTPError) -> NoReturn: error_data = json.loads(body) if isinstance(error_data, dict) and "reason" in error_data: error_message = error_data["reason"] - except (ValueError, json.JSONDecodeError): + except json.JSONDecodeError: error_message = body or error_message errors: dict[int, tuple[type[InstaparserAPIError], str]] = { @@ -192,7 +192,7 @@ def _read_json(self, response: HTTPResponse) -> dict[str, Any]: parsed = json.loads(body) if isinstance(parsed, dict): return parsed - except (ValueError, json.JSONDecodeError): + except json.JSONDecodeError: pass return {"raw": body}