Commit ee8f5e06 authored by Robin Obůrka's avatar Robin Obůrka

msgloop: Report broken output messages in standalone way

The LoopFail exception will by eaten by except Exception, but I want to
be able to distinguish between broken input and broken output error in
logs.
parent 8ab2a579
......@@ -20,6 +20,8 @@ class LoopHardFail(Exception):
pass
class LoopFail(Exception):
pass
def sn_main(box_name, process, setup=None, teardown=None, argparser=None, args=None):
......@@ -159,10 +161,13 @@ def process_result(socket_send, result):
if not socket_send:
raise SetupError("Box generated output but there is any output socket. Bad configuration?")
try:
msg_type, payload = result
msg_out = encode_msg(msg_type, payload)
socket_send.send_multipart(msg_out)
# TODO: Hard fail on InvalidMsgError in box output?
except (ValueError, InvalidMsgError) as e:
raise LoopFail("Generated broken output message. Possibly bug in box.")
def register_signals(context):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment