Skip to content

Commit

Permalink
cmk-messaging: transport exc info
Browse files Browse the repository at this point in the history
Change-Id: Iedfc119dda6b0c6a66976c3fb607c483aceedf33
  • Loading branch information
mo-ki committed Oct 23, 2024
1 parent 7dadccf commit 4c05d85
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/cmk-messaging/cmk/messaging/_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,8 @@ def __init__(self, app: AppName, omd_root: Path) -> None:
make_connection_params(omd_root, "localhost", get_local_port())
)
except AMQPConnectionError as e:
raise CMKConnectionError from e
# pika handles exceptions weirdly. We need repr, in order to see something.
raise CMKConnectionError(repr(e)) from e

def channel(self, model: type[_ModelT]) -> Channel[_ModelT]:
return Channel(self.app, self._pconnection.channel(), model)
Expand All @@ -331,8 +332,10 @@ def __exit__(
try:
return self._pconnection.__exit__(exc_type, value, traceback)
except AMQPConnectionError as e:
raise CMKConnectionError from e
# pika handles exceptions weirdly. We need repr, in order to see something.
raise CMKConnectionError(repr(e)) from e
finally:
# the pika connections __exit__ will swallow these :-(
if isinstance(value, SystemExit):
raise value

Expand Down

0 comments on commit 4c05d85

Please sign in to comment.