File tree Expand file tree Collapse file tree 2 files changed +8
-2
lines changed
Expand file tree Collapse file tree 2 files changed +8
-2
lines changed Original file line number Diff line number Diff line change 77
88from . import Updater , UpdateInfo
99
10+ class GithubUpdaterException (Exception ):
11+ pass
12+
1013class GithubUpdater (Updater ):
1114 def __init__ (self , session ):
1215 self .session = session
1316
1417 def get_latest_release (self , dev = False ):
1518 param = dev and "dev" or "master"
1619 r = self .session .get ("https://api.github.com/repos/fffonion/xeHentai/commits?sha=%s" % param )
17- commit = r .json ()[0 ]
20+ commit = r .json ()
21+ if r .status_code != 200 or not commit :
22+ raise GithubUpdaterException ("Failed to get latest release info: %s" % r .text )
23+ commit = commit [0 ]
1824 sha = commit ["sha" ]
1925 url = "https://github.com/fffonion/xeHentai/archive/%s.zip" % sha
2026
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ def check_update(l=None, config={}):
4040 with zipfile .ZipFile (StringIO (z )) as zf :
4141 make_src_update_file (zf , g .get_src_path_in_archive (info ), info )
4242 l .info (i18n .UPDATE_COMPLETE )
43- except MemoryError as ex :
43+ except Exception as ex :
4444 l .warn (i18n .UPDATE_FAILED % str (ex ))
4545
4646
You can’t perform that action at this time.
0 commit comments