Skip to content

Commit 650b25d

Browse files
committed
Add JSON decoding error logging
1 parent 225269f commit 650b25d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Changelog
22

33
## [Unreleased]
4+
### Added
5+
- JSON decoding error logging, by @HardNorth
46

57
## [5.5.3]
68
### Fixed

reportportal_client/core/rp_responses.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ def json(self) -> Any:
8282
if self.__json is NOT_SET:
8383
try:
8484
self.__json = self._resp.json()
85-
except (JSONDecodeError, TypeError):
85+
except (JSONDecodeError, TypeError) as exc:
86+
logger.warning('Unable to decode JSON response, please check your endpoint configuration or API '
87+
'key', exc_info=exc)
8688
self.__json = None
8789
return self.__json
8890

@@ -149,7 +151,9 @@ async def json(self) -> Any:
149151
if self.__json is NOT_SET:
150152
try:
151153
self.__json = await self._resp.json()
152-
except (JSONDecodeError, TypeError):
154+
except (JSONDecodeError, TypeError) as exc:
155+
logger.warning('Unable to decode JSON response, please check your endpoint configuration or API '
156+
'key', exc_info=exc)
153157
self.__json = None
154158
return self.__json
155159

0 commit comments

Comments
 (0)