catch errors in inital startup and report them before dying

This commit is contained in:
Damien Elmes 2010-02-06 00:48:50 +09:00
parent 4b978e0d86
commit ea42e18a58

View file

@ -30,6 +30,7 @@ config = ankiqt.config
class AnkiQt(QMainWindow): class AnkiQt(QMainWindow):
def __init__(self, app, config, args): def __init__(self, app, config, args):
QMainWindow.__init__(self) QMainWindow.__init__(self)
try:
self.errorOccurred = False self.errorOccurred = False
self.inDbHandler = False self.inDbHandler = False
self.reviewingStarted = False self.reviewingStarted = False
@ -95,6 +96,10 @@ class AnkiQt(QMainWindow):
self.deck.syncName): self.deck.syncName):
self.syncDeck(interactive=False) self.syncDeck(interactive=False)
signal.signal(signal.SIGINT, self.onSigInt) signal.signal(signal.SIGINT, self.onSigInt)
except:
ui.utils.showInfo("Error during startup:\n%s" %
traceback.format_exc())
sys.exit(1)
def onSigInt(self, signum, frame): def onSigInt(self, signum, frame):
self.close() self.close()