Skip to content

Commit 86fb3fa

Browse files
glenscCopilot
andcommitted
Narrow exception catch in _load_data to specific exceptions
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
1 parent b4c4156 commit 86fb3fa

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

trakt/errors.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,13 @@ def __init__(self, response=None):
7777

7878
@staticmethod
7979
def _load_data(response):
80+
from json import JSONDecodeError
81+
8082
if response is None:
8183
return {}
8284
try:
8385
data = response.json()
84-
except Exception:
86+
except (ValueError, JSONDecodeError, AttributeError):
8587
return {}
8688
if not isinstance(data, dict):
8789
return {}

0 commit comments

Comments
 (0)