Nicer error message when contacting GitHub to check for latest release fails
This commit is contained in:
parent
7d9d096fbf
commit
d5490475f1
@ -72,7 +72,10 @@ class Reporter: # {{{
|
|||||||
def get_latest_release_data():
|
def get_latest_release_data():
|
||||||
print('Checking for latest release on GitHub...')
|
print('Checking for latest release on GitHub...')
|
||||||
req = urllib.Request('https://api.github.com/repos/kovidgoyal/kitty/releases/latest', headers={'Accept': 'application/vnd.github.v3+json'})
|
req = urllib.Request('https://api.github.com/repos/kovidgoyal/kitty/releases/latest', headers={'Accept': 'application/vnd.github.v3+json'})
|
||||||
res = urllib.urlopen(req).read().decode('utf-8')
|
try:
|
||||||
|
res = urllib.urlopen(req).read().decode('utf-8')
|
||||||
|
except Exception as err:
|
||||||
|
raise SystemExit('Failed to contact {} with error: {}'.format(req.get_full_url(), err))
|
||||||
data = json.loads(res)
|
data = json.loads(res)
|
||||||
html_url = data['html_url'].replace('/tag/', '/download/').rstrip('/')
|
html_url = data['html_url'].replace('/tag/', '/download/').rstrip('/')
|
||||||
for asset in data.get('assets', ()):
|
for asset in data.get('assets', ()):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user