mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 00:36:38 -04:00
don't throw a traceback when internet down
This commit is contained in:
parent
027aad43aa
commit
4e5b04611e
1 changed files with 8 additions and 1 deletions
|
@ -67,6 +67,8 @@ class SyncManager(QObject):
|
||||||
elif evt == "newKey":
|
elif evt == "newKey":
|
||||||
self.pm.profile['syncKey'] = args[0]
|
self.pm.profile['syncKey'] = args[0]
|
||||||
self.pm.save()
|
self.pm.save()
|
||||||
|
elif evt == "offline":
|
||||||
|
tooltip(_("Syncing failed; internet offline."))
|
||||||
elif evt == "sync":
|
elif evt == "sync":
|
||||||
m = None; t = args[0]
|
m = None; t = args[0]
|
||||||
if t == "login":
|
if t == "login":
|
||||||
|
@ -253,7 +255,12 @@ class SyncThread(QThread):
|
||||||
# write new details and tell calling thread to save
|
# write new details and tell calling thread to save
|
||||||
self.fireEvent("newKey", self.hkey)
|
self.fireEvent("newKey", self.hkey)
|
||||||
# run sync and check state
|
# run sync and check state
|
||||||
ret = self.client.sync()
|
try:
|
||||||
|
ret = self.client.sync()
|
||||||
|
except Exception, e:
|
||||||
|
if "Unable to find the server" in unicode(e):
|
||||||
|
self.fireEvent("offline")
|
||||||
|
return
|
||||||
if ret == "badAuth":
|
if ret == "badAuth":
|
||||||
return self.fireEvent("badAuth")
|
return self.fireEvent("badAuth")
|
||||||
elif ret == "clockOff":
|
elif ret == "clockOff":
|
||||||
|
|
Loading…
Reference in a new issue