Skip to content

Commit 50cd1d8

Browse files
committed
Update exceptions.py
Python 2 `json` module doesn't have a `JSONDecodeError`. **ugh** Fortunately `JSONDecodeError` is a subclass of `ValueError`, so we can use this to catch the same parsing error in both Python 2 and 3.
1 parent 5606c88 commit 50cd1d8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

webexteamssdk/exceptions.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232

3333
import logging
3434
from builtins import *
35-
from json import JSONDecodeError
3635

3736
import requests
3837

@@ -80,7 +79,7 @@ def __init__(self, response):
8079
self.response.headers.get("Content-Type", "").lower():
8180
try:
8281
self.details = self.response.json()
83-
except JSONDecodeError:
82+
except ValueError:
8483
logger.warning("Error parsing JSON response body")
8584

8685
self.message = self.details.get("message") if self.details else None

0 commit comments

Comments
 (0)