contrib: Detailed reporting for http errors in github-merge
Print detailed error, this makes it easier to diagnose github API issues.
This commit is contained in:
parent
035f349371
commit
059a3cffdf
1 changed files with 6 additions and 0 deletions
|
@ -23,6 +23,7 @@ import sys
|
||||||
import json
|
import json
|
||||||
import codecs
|
import codecs
|
||||||
from urllib.request import Request, urlopen
|
from urllib.request import Request, urlopen
|
||||||
|
from urllib.error import HTTPError
|
||||||
|
|
||||||
# External tools (can be overridden using environment)
|
# External tools (can be overridden using environment)
|
||||||
GIT = os.getenv('GIT','git')
|
GIT = os.getenv('GIT','git')
|
||||||
|
@ -57,6 +58,11 @@ def retrieve_pr_info(repo,pull):
|
||||||
reader = codecs.getreader('utf-8')
|
reader = codecs.getreader('utf-8')
|
||||||
obj = json.load(reader(result))
|
obj = json.load(reader(result))
|
||||||
return obj
|
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:
|
except Exception as e:
|
||||||
print('Warning: unable to retrieve pull information from github: %s' % e)
|
print('Warning: unable to retrieve pull information from github: %s' % e)
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Add table
Reference in a new issue