Skip to content

Commit

Permalink
Handle non-JSON response from the server.
Browse files Browse the repository at this point in the history
  • Loading branch information
dyakhnov committed Feb 18, 2021
1 parent a62c8dd commit aebac2f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion mydata/utils/upload.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ def HandleResponse(rsp):
"""
Handle API call response
"""
data = json.loads(rsp.content)
try:
data = json.loads(rsp.content)
except:
raise Exception("Unexpected data received from the server.")
if "success" not in data:
if "error_message" in data:
raise Exception(data["error_message"])
Expand Down

0 comments on commit aebac2f

Please sign in to comment.