Commit e71d899d authored by Kyle Ju's avatar Kyle Ju Committed by Commit Bot

[WPT Exporter] Improve logging for unprocessable Entity 422 issue

Improve logging for unprocessable entity 422 issue because GitHub does not return an informative HTTPError. 422 error is caused by (1) branch already exists but somehow create_pr is reached (2) missing Change_Id in the original CL.

Bug: 1056378
Change-Id: I92e0c59f30c5436121ac88af3972a3be0e2a46bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2097156
Commit-Queue: Kyle Ju <kyleju@chromium.org>
Reviewed-by: default avatarRobert Ma <robertma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#750619}
parent 41806cca
......@@ -121,7 +121,15 @@ class WPTGitHub(object):
'head': remote_branch_name,
'base': 'master',
}
response = self.request(path, method='POST', body=body)
try:
response = self.request(path, method='POST', body=body)
except urllib2.HTTPError as e:
_log.error(e.reason)
if e.code == 422:
_log.error('Please check if branch already exists; If so, '
'please remove the PR description and '
'delete the branch')
raise GitHubError(201, e.code, 'create PR branch %s' % remote_branch_name)
if response.status_code != 201:
raise GitHubError(201, response.status_code, 'create PR')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment