IndominusByte / fastapi-jwt-auth

FastAPI extension that provides JWT Auth support (secure, easy to use, and lightweight)
http://indominusbyte.github.io/fastapi-jwt-auth/
MIT License
660 stars 153 forks source link

Add message and status_code to base " AuthJWTException" class #97

Open martinEnerdis opened 1 year ago

martinEnerdis commented 1 year ago

Hello, for typing and linting purposes I think it would be a good idea to include those attributes (message and status code) to the base class, given that they are present in all sub classes. By doing so, the following code would get properly type checked:

@app.exception_handler(AuthJWTException)
def authjwt_exception_handler(request: Request, exc: AuthJWTException) -> JSONResponse:
    return JSONResponse(status_code=exc.status_code, content={"detail": exc.message})  # type: ignore