phabstatus: handle JSON decode error

Summary:
Sometimes GraphQL does not return JSON result. Do not crash on the client-side.

Context:
https://fb.workplace.com/groups/scm/permalink/2565497036833234/

Reviewed By: farnz

Differential Revision: D19254348

fbshipit-source-id: 75ca93b1dc8648d5c59915ecf450b9366df13c01
This commit is contained in:
Jun Wu 2019-12-30 16:42:25 -08:00 committed by Facebook Github Bot
parent d7504bffa5
commit 3db941beb4

View File

@ -100,6 +100,13 @@ def getdiffstatus(repo, *diffid):
hint = _("Error info: %s\n") % str(ex) hint = _("Error info: %s\n") % str(ex)
ret = _fail(repo, diffid, msg, hint) ret = _fail(repo, diffid, msg, hint)
return ret return ret
except ValueError as ex:
msg = _(
"Error decoding GraphQL response. No diff information can be provided.\n"
)
hint = _("Error info: %s\n") % str(ex)
ret = _fail(repo, diffid, msg, hint)
return ret
# This makes the code more robust in case we don't learn about any # This makes the code more robust in case we don't learn about any
# particular revision # particular revision