Skip to content

Commit cbf7851

Browse files
fix(python/fastapi): empty groupingFn exception handling (#1202)
## 🧰 Changes Small fix for a groupingFn exception handling (just to make sure app is not crashing)
1 parent e42c4c3 commit cbf7851

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/python/readme_metrics/fastapi.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,10 @@ async def preamble(self, request):
5858
self.config.LOGGER.exception(e)
5959

6060
async def dispatch(self, request: Request, call_next):
61-
if request.method == "OPTIONS" or self.config.GROUPING_FUNCTION is None:
61+
if (
62+
request.method == "OPTIONS"
63+
or self.config.GROUPING_FUNCTION(request) is None
64+
):
6265
return await call_next(request)
6366

6467
await self.preamble(request)
@@ -81,6 +84,7 @@ async def dispatch(self, request: Request, call_next):
8184

8285
except Exception as e:
8386
self.config.LOGGER.exception(e)
87+
return await call_next(request)
8488

8589
return Response(
8690
content=response_body,

0 commit comments

Comments
 (0)