Add an IPCError exception.

This commit is contained in:
Florian Bruhin 2014-10-13 07:11:45 +02:00
parent ae61ca8af9
commit 869fd4f752

View File

@ -33,6 +33,11 @@ CONNECT_TIMEOUT = 100
server = None server = None
class IPCError(Exception):
"""Exception raised when there was a problem with IPC."""
def send_to_running_instance(cmdlist): def send_to_running_instance(cmdlist):
"""Try to send a commandline to a running instance. """Try to send a commandline to a running instance.
@ -61,12 +66,10 @@ def init_server():
server = QLocalServer() server = QLocalServer()
ok = QLocalServer.removeServer(SOCKETNAME) ok = QLocalServer.removeServer(SOCKETNAME)
if not ok: if not ok:
# FIXME raise IPCError("Error while removing server {}!".format(SOCKETNAME))
raise Exception
ok = server.listen(SOCKETNAME) ok = server.listen(SOCKETNAME)
if not ok: if not ok:
# FIXME raise IPCError("Error while listening to local socket: {}".format(
raise Exception("Error while listening to local socket: {}".format(
server.errorString())) server.errorString()))
server.newConnection.connect(on_localsocket_connection) server.newConnection.connect(on_localsocket_connection)