Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hook to handle unexpected errors on routing messages #70

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion hl7apy/mllp.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ def handle(self):
if message is not None:
try:
response = self._route_message(message)
except Exception:
except Exception as exc:
self._handle_routing_error(exc, message)
self.request.close()
else:
# encode the response
Expand Down Expand Up @@ -138,6 +139,9 @@ def _create_handler(self, handler_class, msg, args):
def _create_error_handler(self, handler_class, exc, msg, args):
return handler_class(exc, msg, *args)

def _handle_routing_error(self, exc, msg):
pass


class MLLPServer(ThreadingTCPServer):
"""
Expand Down