fastapi-jwt-auth icon indicating copy to clipboard operation
fastapi-jwt-auth copied to clipboard

Add message and status_code to base " AuthJWTException" class

Open martinEnerdis opened this issue 2 years ago • 1 comments

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

martinEnerdis avatar Apr 20 '23 15:04 martinEnerdis