Commit 6ab6b72c by Greg Price

Merge pull request #3941 from edx/gprice/handle-invalid-json

Improve handling of bad JSON from comments service
parents a415b507 dc234285
......@@ -104,7 +104,15 @@ def perform_request(method, url, data_or_params=None, raw=False,
if raw:
return response.text
else:
data = response.json()
try:
data = response.json()
except ValueError:
raise CommentClientError(
u"Comments service returned invalid JSON for request {request_id}; first 100 characters: '{content}'".format(
request_id=request_id,
content=response.text[:100]
)
)
if paged_results:
dog_stats_api.histogram(
'comment_client.request.paged.result_count',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment