fix response
This commit is contained in:
parent
1ebba9f846
commit
3e8d2a5ba1
1 changed files with 3 additions and 2 deletions
|
|
@ -174,6 +174,7 @@ def register_exception_handlers(app: FastAPI):
|
||||||
@app.exception_handler(Exception)
|
@app.exception_handler(Exception)
|
||||||
async def basic_error(request: Request, err):
|
async def basic_error(request: Request, err):
|
||||||
print("handled error", traceback.format_exc())
|
print("handled error", traceback.format_exc())
|
||||||
|
print("ERROR:", err)
|
||||||
etype, _, tb = sys.exc_info()
|
etype, _, tb = sys.exc_info()
|
||||||
traceback.print_exception(etype, err, tb)
|
traceback.print_exception(etype, err, tb)
|
||||||
exc = traceback.format_exc()
|
exc = traceback.format_exc()
|
||||||
|
|
@ -185,5 +186,5 @@ def register_exception_handlers(app: FastAPI):
|
||||||
|
|
||||||
return JSONResponse(
|
return JSONResponse(
|
||||||
status_code=HTTPStatus.NO_CONTENT,
|
status_code=HTTPStatus.NO_CONTENT,
|
||||||
content={"detail": exc},
|
content={"detail": err},
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue