From 5bc4f85dc589b8d88c013e87a55a1591f1e4edc8 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Mon, 13 Oct 2014 20:36:41 +0200 Subject: [PATCH] Fix QLocalServer error checking. --- qutebrowser/utils/ipc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/qutebrowser/utils/ipc.py b/qutebrowser/utils/ipc.py index 01fd61498..ffe383c16 100644 --- a/qutebrowser/utils/ipc.py +++ b/qutebrowser/utils/ipc.py @@ -49,7 +49,9 @@ class IPCServer(QObject): self._server = QLocalServer(self) ok = self._server.listen(SOCKETNAME) if not ok: - _socket_error("listening to local server", self._server) + raise IPCError("Error while listening to IPC server: {} " + "(error {})".format(self._server.errorString(), + self._server.serverError())) self._server.newConnection.connect(self.on_connection) self._socket = None @@ -110,11 +112,11 @@ def init(): def _socket_error(action, socket): - """Raise an IPCError based on an action and a QLocal{Socket,Server}. + """Raise an IPCError based on an action and a QLocalSocket. Args: action: A string like "writing to running instance". - socket: A QLocalSocket or QLocalServer. + socket: A QLocalSocket. """ raise IPCError("Error while {}: {} (error {})".format( action, socket.errorString(), socket.error()))