mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
unify pre-check, sanity-check and upload error messages
This commit is contained in:
parent
79d4451299
commit
ab198c46be
2 changed files with 8 additions and 14 deletions
|
@ -145,7 +145,7 @@ class Syncer(object):
|
||||||
self.col.rollback()
|
self.col.rollback()
|
||||||
self.col.modSchema()
|
self.col.modSchema()
|
||||||
self.col.save()
|
self.col.save()
|
||||||
raise Exception("collection sanity check failed")
|
return "sanityCheckFailed"
|
||||||
# finalize
|
# finalize
|
||||||
runHook("sync", "finalize")
|
runHook("sync", "finalize")
|
||||||
mod = self.server.finish()
|
mod = self.server.finish()
|
||||||
|
|
20
aqt/sync.py
20
aqt/sync.py
|
@ -86,9 +86,7 @@ automatically."""))
|
||||||
tooltip(_("Syncing failed; internet offline."))
|
tooltip(_("Syncing failed; internet offline."))
|
||||||
elif evt == "upbad":
|
elif evt == "upbad":
|
||||||
self._didFullUp = False
|
self._didFullUp = False
|
||||||
showWarning(_("""\
|
self._checkFailed()
|
||||||
The upload was aborted because errors were found in your collection. \
|
|
||||||
Please check your collection with Tools>Check Database."""))
|
|
||||||
elif evt == "sync":
|
elif evt == "sync":
|
||||||
m = None; t = args[0]
|
m = None; t = args[0]
|
||||||
if t == "login":
|
if t == "login":
|
||||||
|
@ -114,8 +112,8 @@ Please visit AnkiWeb, upgrade your deck, then try again."""))
|
||||||
self._rewriteError(args[0]))
|
self._rewriteError(args[0]))
|
||||||
elif evt == "clockOff":
|
elif evt == "clockOff":
|
||||||
self._clockOff()
|
self._clockOff()
|
||||||
elif evt == "basicCheckFailed":
|
elif evt == "checkFailed":
|
||||||
self._basicCheckFailed()
|
self._checkFailed()
|
||||||
elif evt == "noChanges":
|
elif evt == "noChanges":
|
||||||
pass
|
pass
|
||||||
elif evt == "fullSync":
|
elif evt == "fullSync":
|
||||||
|
@ -160,10 +158,6 @@ AnkiWeb is too busy at the moment. Please try again in a few minutes.""")
|
||||||
"software is blocking Anki from connecting to the internet.")
|
"software is blocking Anki from connecting to the internet.")
|
||||||
elif "407" in err:
|
elif "407" in err:
|
||||||
return _("Proxy authentication required.")
|
return _("Proxy authentication required.")
|
||||||
elif "collection sanity check failed" in err:
|
|
||||||
return _("After syncing, the collection was in an inconsistent \
|
|
||||||
state. To fix this problem, Anki will force a full sync. Please sync again, and \
|
|
||||||
choose which side you would like to keep.")
|
|
||||||
return err
|
return err
|
||||||
|
|
||||||
def _getUserPass(self):
|
def _getUserPass(self):
|
||||||
|
@ -239,10 +233,10 @@ automatically."""),
|
||||||
Syncing requires the clock on your computer to be set correctly. Please \
|
Syncing requires the clock on your computer to be set correctly. Please \
|
||||||
fix the clock and try again."""))
|
fix the clock and try again."""))
|
||||||
|
|
||||||
def _basicCheckFailed(self):
|
def _checkFailed(self):
|
||||||
showWarning(_("""\
|
showWarning(_("""\
|
||||||
Your collection is in an inconsistent state. Please run Tools>\
|
Your collection is in an inconsistent state. Please run Tools>\
|
||||||
Maintenance>Check Database."""))
|
Check Database, then sync again."""))
|
||||||
|
|
||||||
def badUserPass(self):
|
def badUserPass(self):
|
||||||
aqt.preferences.Preferences(self, self.pm.profile).dialog.tabWidget.\
|
aqt.preferences.Preferences(self, self.pm.profile).dialog.tabWidget.\
|
||||||
|
@ -337,8 +331,8 @@ class SyncThread(QThread):
|
||||||
return self.fireEvent("badAuth")
|
return self.fireEvent("badAuth")
|
||||||
elif ret == "clockOff":
|
elif ret == "clockOff":
|
||||||
return self.fireEvent("clockOff")
|
return self.fireEvent("clockOff")
|
||||||
elif ret == "basicCheckFailed":
|
elif ret == "basicCheckFailed" or ret == "sanityCheckFailed":
|
||||||
return self.fireEvent("basicCheckFailed")
|
return self.fireEvent("checkFailed")
|
||||||
# note mediaUSN for later
|
# note mediaUSN for later
|
||||||
self.mediaUsn = self.client.mediaUsn
|
self.mediaUsn = self.client.mediaUsn
|
||||||
# full sync?
|
# full sync?
|
||||||
|
|
Loading…
Reference in a new issue