fix: dont log routes.json 404 (#3665)
This commit is contained in:
parent
7747d7b741
commit
b6e111b21c
1 changed files with 3 additions and 1 deletions
|
|
@ -138,7 +138,9 @@ def register_exception_handlers(app: FastAPI): # noqa: C901
|
||||||
|
|
||||||
@app.exception_handler(404)
|
@app.exception_handler(404)
|
||||||
async def error_handler_404(request: Request, exc: HTTPException):
|
async def error_handler_404(request: Request, exc: HTTPException):
|
||||||
logger.error(f"404: {request.url.path} {exc.status_code}: {exc.detail}")
|
|
||||||
|
if not request.url.path.endswith("routes.json"):
|
||||||
|
logger.error(f"404: {request.url.path} {exc.status_code}: {exc.detail}")
|
||||||
|
|
||||||
if not _is_browser_request(request):
|
if not _is_browser_request(request):
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue