mirror of
https://github.com/DrizzleTime/Foxel.git
synced 2026-05-19 23:30:35 +08:00
refactor: optimize backend module
This commit is contained in:
11
middleware/exception_handler.py
Normal file
11
middleware/exception_handler.py
Normal file
@@ -0,0 +1,11 @@
|
||||
from fastapi import Request, status
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
async def global_exception_handler(request: Request, exc: Exception):
|
||||
"""
|
||||
全局异常处理
|
||||
"""
|
||||
return JSONResponse(
|
||||
status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
|
||||
content={"error": "Internal Server Error", "detail": str(exc)},
|
||||
)
|
||||
Reference in New Issue
Block a user