fix response
This commit is contained in:
+2
-1
@@ -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},
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user