ipc: Simplify exception handling.

This commit is contained in:
Florian Bruhin 2015-09-04 07:16:16 +02:00
parent ea0cbea1dd
commit 9b1d0af20d

View File

@ -353,6 +353,7 @@ def send_or_listen(args):
None if an instance was running and received our request. None if an instance was running and received our request.
""" """
socketname = _get_socketname(args.basedir) socketname = _get_socketname(args.basedir)
try:
try: try:
sent = send_to_running_instance(socketname, args.command) sent = send_to_running_instance(socketname, args.command)
if sent: if sent:
@ -366,14 +367,10 @@ def send_or_listen(args):
# This could be a race condition... # This could be a race condition...
log.init.debug("Got AddressInUseError, trying again.") log.init.debug("Got AddressInUseError, trying again.")
time.sleep(0.5) time.sleep(0.5)
try:
sent = send_to_running_instance(socketname, args.command) sent = send_to_running_instance(socketname, args.command)
if sent: if sent:
return None return None
else: else:
raise e
except Error as e:
display_error(e, args)
raise raise
except Error as e: except Error as e:
display_error(e, args) display_error(e, args)