phabricator: check for error field in reponse

Summary:
The latest error reponses that we see for phabricator have only one field called
`error` that lists a message. Adding handling for this case.

Reviewed By: quark-zju

Differential Revision: D17290349

fbshipit-source-id: ebfd9d7b07f30cbfe3171259efcfc6a00a1abdce
This commit is contained in:
Stefan Filip 2019-09-10 16:28:16 -07:00 committed by Facebook Github Bot
parent 97c13edcc7
commit b2471ea3c6

View File

@ -208,8 +208,13 @@ class Client(object):
def _processrevisioninfo(self, ret):
try:
errormsg = ret["errors"][0]["message"]
raise ClientError(None, errormsg)
errormsg = None
if "error" in ret:
errormsg = ret["error"]
if "errors" in ret:
errormsg = ret["errors"][0]["message"]
if errormsg is not None:
raise ClientError(None, errormsg)
except (KeyError, TypeError):
pass