Skip to content
Snippets Groups Projects
Commit 73cc8578 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-777: processed review comments

parent e01cd5a8
No related branches found
No related tags found
1 merge request!12Lofar release 4 0 - merge back release patches and features to master
......@@ -193,6 +193,9 @@ class ServiceMessageHandler(UsingToBusMixin, AbstractMessageHandler):
if not isinstance(msg, RequestMessage):
raise ValueError("%s: Ignoring non-RequestMessage: %s" % (self.__class__.__name__, msg))
# handle the RequestMessage via the _service_handle_message
# create a ReplyMessage based on the success (exception or not)
# use the reply_msg.handled_successfully as state variable for error handling below...
try:
result = self._service_handle_message(msg)
reply_msg = ReplyMessage(content=result,
......@@ -206,11 +209,12 @@ class ServiceMessageHandler(UsingToBusMixin, AbstractMessageHandler):
subject=msg.reply_to,
error_message=str(e))
try:
# try to send back the reply, might raise on itself, which is ok, it's handled by the buslistener.
self.send(reply_msg)
except Exception as e:
logger.warning(e)
# send was ok, no exception
# now check reply_msg.handled_successfully state variable,
# and raise if False. The exception is then handled by the buslistener.
if not reply_msg.handled_successfully:
raise Exception(reply_msg.error_message)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment