[FIX] runbot_merge: merge() can be non-json in some cases (???)

Rather than blow up with a json error and take down the cron, convert
json decode error to a mergeerror in order to put the PR in error and
try to dump however much data we can.
This commit is contained in:
Xavier Morel 2018-10-08 16:30:51 +02:00
parent dd29e6b8a8
commit 16c492ef0a

View File

@ -114,7 +114,10 @@ class GH(object):
'head': sha,
'commit_message': message,
}, check={409: exceptions.MergeError})
r = r.json()
try:
r = r.json()
except Exception:
raise exceptions.MergeError("Got non-JSON reponse from github: %s %s (%s)" % (r.status_code, r.reason, r.content.decode('iso-8859-1')))
_logger.debug("merge(%s, %s, %s) -> %s", self._repo, dest, shorten(message), r['sha'])
return dict(r['commit'], sha=r['sha'])