mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
handle case where exception has no args
This commit is contained in:
parent
7be04bc2d5
commit
5d1376acb9
1 changed files with 7 additions and 6 deletions
13
aqt/sync.py
13
aqt/sync.py
|
@ -261,17 +261,18 @@ class SyncThread(QThread):
|
|||
try:
|
||||
ret = self.client.sync()
|
||||
except Exception, e:
|
||||
if isinstance(e[0], str):
|
||||
log = traceback.format_exc()
|
||||
try:
|
||||
err = unicode(e[0], "utf8", "ignore")
|
||||
else:
|
||||
except:
|
||||
# number, exception with no args, etc
|
||||
err = ""
|
||||
if "Unable to find the server" in err:
|
||||
self.fireEvent("offline")
|
||||
else:
|
||||
err = traceback.format_exc()
|
||||
if not isinstance(err, unicode):
|
||||
err = unicode(err, "utf8", "replace")
|
||||
self.fireEvent("error", err)
|
||||
if not isinstance(log, unicode):
|
||||
err = unicode(log, "utf8", "replace")
|
||||
self.fireEvent("error", log)
|
||||
return
|
||||
if ret == "badAuth":
|
||||
return self.fireEvent("badAuth")
|
||||
|
|
Loading…
Reference in a new issue