Cleanup
This commit is contained in:
@@ -31,14 +31,12 @@ app = FastAPI()
|
|||||||
|
|
||||||
|
|
||||||
@app.exception_handler(ValueError)
|
@app.exception_handler(ValueError)
|
||||||
async def value_error_handler(_request: Request, exc: ValueError): # pragma: no cover
|
async def value_error_handler(_request: Request, exc: ValueError):
|
||||||
return JSONResponse(status_code=400, content={"detail": str(exc)})
|
return JSONResponse(status_code=400, content={"detail": str(exc)})
|
||||||
|
|
||||||
|
|
||||||
@app.exception_handler(Exception)
|
@app.exception_handler(Exception)
|
||||||
async def general_exception_handler(
|
async def general_exception_handler(_request: Request, exc: Exception):
|
||||||
_request: Request, exc: Exception
|
|
||||||
): # pragma: no cover
|
|
||||||
logging.exception("Unhandled exception in API app")
|
logging.exception("Unhandled exception in API app")
|
||||||
return JSONResponse(status_code=500, content={"detail": "Internal server error"})
|
return JSONResponse(status_code=500, content={"detail": "Internal server error"})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user