Skip to content

Commit d00cec8

Browse files
committed
Only log to error reporter if status code is a 500 (#117)
1 parent f134700 commit d00cec8

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

breadbox/breadbox/main.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,12 @@
3333

3434
@app.exception_handler(StarletteHTTPException)
3535
async def custom_http_exception_handler(request: Request, exc: StarletteHTTPException):
36-
if exception_reporter.disabled is False:
36+
if (exception_reporter.disabled is False) and (500 <= exc.status_code < 600):
3737
exception_reporter.report(request, exc.status_code, get_user(request))
3838

3939
return await http_exception_handler(request, exc)
4040

4141

42-
@app.exception_handler(RequestValidationError)
43-
async def custom_request_validation_exception_handler(
44-
request: Request, exc: RequestValidationError
45-
):
46-
exception_reporter.report(
47-
request, status.HTTP_422_UNPROCESSABLE_ENTITY, get_user(request)
48-
)
49-
return await request_validation_exception_handler(request, exc)
50-
51-
5242
@app.exception_handler(Exception)
5343
async def custom_exception_handler(request: Request, exc: Exception):
5444
exception_reporter.report(

0 commit comments

Comments
 (0)