Skip to content

Commit

Permalink
do not return exceptions over IPC
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderegg committed Sep 20, 2023
1 parent 155fdad commit 3b278d3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/service-library/src/servicelib/rabbitmq/_rpc_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@ async def wrapper(*args, **kwargs):
msg=f"calling {func.__name__} with {args}, {kwargs}",
):
try:
result = await func(*args, **kwargs)
return result
return await func(*args, **kwargs)
except asyncio.CancelledError:
_logger.debug("call was cancelled")
raise
except Exception as exc: # pylint: disable=broad-except
_logger.exception("Unhandled exception:")
# NOTE: we do not return internal exceptions over RPC
raise RPCServerError(
method_name=func.__name__, exc_type=type(exc), msg=f"{exc}"
) from exc
method_name=func.__name__,
exc_type=f"{type(exc)}",
msg=f"{exc}",
) from None

self.routes[RPCMethodName(func.__name__)] = wrapper
return func
Expand Down

0 comments on commit 3b278d3

Please sign in to comment.