From 177707687cfd05442f35d8b96b5fedb7efb757dd Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Sun, 28 Dec 2014 00:48:27 +0100 Subject: [PATCH] Display IPC errors to the user. Fixes #337. --- qutebrowser/app.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/qutebrowser/app.py b/qutebrowser/app.py index 067623df2..7dd703660 100644 --- a/qutebrowser/app.py +++ b/qutebrowser/app.py @@ -109,6 +109,18 @@ class Application(QApplication): if sent: sys.exit(0) + log.init.debug("Starting IPC server...") + try: + ipc.init() + except ipc.IPCError as e: + text = ('{}\n\nMaybe another instance is running but ' + 'frozen?'.format(e)) + msgbox = QMessageBox(QMessageBox.Critical, "Error while " + "connecting to running instance!", text) + msgbox.exec_() + # We didn't really initialize much so far, so we just quit hard. + sys.exit(1) + log.init.debug("Starting init...") self.setQuitOnLastWindowClosed(False) self.setOrganizationName("qutebrowser") @@ -135,9 +147,6 @@ class Application(QApplication): log.init.debug("Applying python hacks...") self._python_hacks() - log.init.debug("Starting IPC server...") - ipc.init() - QDesktopServices.setUrlHandler('http', self.open_desktopservices_url) QDesktopServices.setUrlHandler('https', self.open_desktopservices_url) QDesktopServices.setUrlHandler('qute', self.open_desktopservices_url)