Skip to content

Commit ca50504

Browse files
committed
apply copilot suggestion
1 parent c1478cd commit ca50504

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

fishjam/api/_client.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,16 @@ def _handle_deprecation_header(self, headers):
3434
deprecation_warning = headers.get("x-fishjam-api-deprecated")
3535
if deprecation_warning and not self.warnings_shown:
3636
self.warnings_shown = True
37-
deprecation_warning = json.loads(deprecation_warning)
37+
try:
38+
deprecation_data = json.loads(deprecation_warning)
39+
except (json.JSONDecodeError, TypeError, ValueError):
40+
return
3841

39-
status = deprecation_warning["status"]
40-
msg = deprecation_warning["message"]
42+
status = deprecation_data["status"]
43+
msg = deprecation_data["message"]
44+
45+
if not status or not msg:
46+
return
4147

4248
match status:
4349
case "unsupported":

0 commit comments

Comments
 (0)