Skip to content

Commit c8cfe9f

Browse files
fix capture exeptrioin in all senario
1 parent 123e69a commit c8cfe9f

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

archipy/helpers/utils/app_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ async def custom_exception_handler(request: Request, exception: BaseError) -> JS
5252
Returns:
5353
JSONResponse: A JSON response containing the exception details.
5454
"""
55+
BaseUtils.capture_exception(exception)
5556
return FastAPIExceptionHandler.create_error_response(exception)
5657

5758
@staticmethod
@@ -65,6 +66,7 @@ async def generic_exception_handler(request: Request, exception: Exception) -> J
6566
Returns:
6667
JSONResponse: A JSON response containing the exception details.
6768
"""
69+
BaseUtils.capture_exception(exception)
6870
return FastAPIExceptionHandler.create_error_response(UnknownError())
6971

7072
@staticmethod
@@ -82,6 +84,7 @@ async def validation_exception_handler(
8284
JSONResponse: A JSON response containing the validation error details.
8385
"""
8486
# Using list comprehension instead of append for better performance
87+
BaseUtils.capture_exception(exception)
8588
errors: list[dict[str, str]] = [
8689
{
8790
"field": ".".join(str(x) for x in error["loc"]),
@@ -90,7 +93,6 @@ async def validation_exception_handler(
9093
}
9194
for error in exception.errors()
9295
]
93-
9496
return JSONResponse(
9597
status_code=HTTPStatus.UNPROCESSABLE_ENTITY,
9698
content={"error": "VALIDATION_ERROR", "detail": errors},

0 commit comments

Comments
 (0)