Merge pull request #5905 from netchampfaris/frappe-client

Extract traceback from failed FrappeClient request and frappe.throw it
This commit is contained in:
Prateeksha Singh 2018-08-01 13:04:01 +05:30 committed by GitHub
commit 544707d478
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -286,7 +286,13 @@ class FrappeClient(object):
raise
if rjson and ("exc" in rjson) and rjson["exc"]:
raise FrappeException(rjson["exc"])
try:
exc = json.loads(rjson["exc"])[0]
exc = 'FrappeClient Request Failed\n\n' + exc
except Exception:
exc = rjson["exc"]
raise FrappeException(exc)
if 'message' in rjson:
return rjson['message']
elif 'data' in rjson: