Skip to content

Commit

Permalink
feat: Handle code 500
Browse files Browse the repository at this point in the history
  • Loading branch information
null2264 committed Jul 17, 2023
1 parent 1584a56 commit bf11595
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion nexus/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import uvicorn
from dotenv import load_dotenv
from fastapi import HTTPException
from fastapi import HTTPException, Request
from starlette.responses import JSONResponse

from nexus.core import constants, routes
Expand Down Expand Up @@ -38,5 +38,10 @@ async def errorHandler(request, exc):
return resp


@app.exception_handler(500)
async def internalServerErrorHandler(request: Request, exc: Exception):
return JSONResponse(status_code=500, content={"code": 500, "msg": "Internal Server Error"})


if __name__ == "__main__":
uvicorn.run("nexus.app:app", reload=DEBUG)

0 comments on commit bf11595

Please sign in to comment.