项目基础模块代码
This commit is contained in:
10
app/application/exception_handler.py
Normal file
10
app/application/exception_handler.py
Normal file
@ -0,0 +1,10 @@
|
||||
from fastapi import HTTPException, Request
|
||||
from app.common.reponse_code import response_error
|
||||
|
||||
from app import my_app
|
||||
"""全局异常处理"""
|
||||
|
||||
|
||||
@my_app.exception_handlers(HTTPException)
|
||||
async def http_exception(request: Request, he: HTTPException):
|
||||
return response_error(request.url + "出现异常:" + he.detail)
|
Reference in New Issue
Block a user