Skip to content

Commit 059a3cf

Browse files
committed
contrib: Detailed reporting for http errors in github-merge
Print detailed error, this makes it easier to diagnose github API issues.
1 parent 035f349 commit 059a3cf

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

contrib/devtools/github-merge.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import json
2424
import codecs
2525
from urllib.request import Request, urlopen
26+
from urllib.error import HTTPError
2627

2728
# External tools (can be overridden using environment)
2829
GIT = os.getenv('GIT','git')
@@ -57,6 +58,11 @@ def retrieve_pr_info(repo,pull):
5758
reader = codecs.getreader('utf-8')
5859
obj = json.load(reader(result))
5960
return obj
61+
except HTTPError as e:
62+
error_message = e.read()
63+
print('Warning: unable to retrieve pull information from github: %s' % e)
64+
print('Detailed error: %s' % error_message)
65+
return None
6066
except Exception as e:
6167
print('Warning: unable to retrieve pull information from github: %s' % e)
6268
return None

0 commit comments

Comments
 (0)