more friendly anki 1 import error

This commit is contained in:
Damien Elmes 2012-03-25 00:52:33 +09:00
parent e5f3d0b7f0
commit d99b707d67

View file

@ -282,9 +282,13 @@ def onImport(mw):
try: try:
importer.run() importer.run()
except Exception, e: except Exception, e:
msg = _("Import failed.\n") if "invalidFile" in unicode(e):
msg += unicode(traceback.format_exc(), "ascii", "replace") showWarning(_("""\
showText(msg) Invalid file. Please run a DB check in Anki 1.2 and try again."""))
else:
msg = _("Import failed.\n")
msg += unicode(traceback.format_exc(), "ascii", "replace")
showText(msg)
else: else:
showText("\n".join(importer.log)) showText("\n".join(importer.log))
finally: finally: