can't specify coding in unicode(except); convert traceback instead

This commit is contained in:
Damien Elmes 2012-05-23 09:19:07 +09:00
parent 4c398fc728
commit 2f6db69113
2 changed files with 4 additions and 2 deletions

View file

@ -201,7 +201,7 @@ class AddonDownloader(QThread):
resp, cont = con.request( resp, cont = con.request(
aqt.appShared + "download/%d" % self.code) aqt.appShared + "download/%d" % self.code)
except Exception, e: except Exception, e:
self.error = unicode(e, "utf8", "replace") self.error = unicode(e)
return return
finally: finally:
remHook("httpRecv", recvEvent) remHook("httpRecv", recvEvent)

View file

@ -122,7 +122,7 @@ Please upgrade to the latest version of Anki.""")
elif "502" in err or "503" in err or "504" in err: elif "502" in err or "503" in err or "504" in err:
return _("""\ return _("""\
AnkiWeb is too busy at the moment. Please try again in a few minutes.""") AnkiWeb is too busy at the moment. Please try again in a few minutes.""")
return unicode(err, "utf8", "replace") return err
def _getUserPass(self): def _getUserPass(self):
d = QDialog(self.mw) d = QDialog(self.mw)
@ -234,6 +234,8 @@ class SyncThread(QThread):
self._sync() self._sync()
except: except:
err = traceback.format_exc() err = traceback.format_exc()
if not isinstance(err, unicode):
err = unicode(err, "utf8", "replace")
self.fireEvent("error", err) self.fireEvent("error", err)
finally: finally:
# don't bump mod time unless we explicitly save # don't bump mod time unless we explicitly save