Skip to content

Commit

Permalink
contrib: Detailed reporting for http errors in github-merge
Browse files Browse the repository at this point in the history
Print detailed error, this makes it easier to diagnose github API issues.
  • Loading branch information
laanwj committed Jan 14, 2019
1 parent 035f349 commit 059a3cf
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions contrib/devtools/github-merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import json
import codecs
from urllib.request import Request, urlopen
from urllib.error import HTTPError

# External tools (can be overridden using environment)
GIT = os.getenv('GIT','git')
Expand Down Expand Up @@ -57,6 +58,11 @@ def retrieve_pr_info(repo,pull):
reader = codecs.getreader('utf-8')
obj = json.load(reader(result))
return obj
except HTTPError as e:
error_message = e.read()
print('Warning: unable to retrieve pull information from github: %s' % e)
print('Detailed error: %s' % error_message)
return None
except Exception as e:
print('Warning: unable to retrieve pull information from github: %s' % e)
return None
Expand Down

0 comments on commit 059a3cf

Please sign in to comment.