We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi,
At the moment, there is the base error class
class AuthJWTException(Exception): """ Base except which all fastapi_jwt_auth errors extend """ pass
and then all the others inherit from that and add the two attributes status_code and message. In the docs, you suggest the following handler:
status_code
message
@app.exception_handler(AuthJWTException) def authjwt_exception_handler(request: Request, exc: AuthJWTException): return JSONResponse( status_code=exc.status_code, content={"detail": exc.message} )
which uses the error's attributes. Technically, the annotated type does not have these attributes.
I don't know why you chose this design but I would like to make a PR to change it to:
class AuthJWTException(Exception): """ Base exception which all fastapi_jwt_auth errors extend. """ def __init__(self,status_code: int, message: str, **kwargs): super().__init__(**kwargs) self.status_code = status_code self.message = message
and then change all others to the following init:
def __init__(self,status_code: int, message: str, **kwargs): super().__init__(status_code=status_code, message=message, **kwargs)
The text was updated successfully, but these errors were encountered:
same problem, any updates on this ?
Sorry, something went wrong.
No branches or pull requests
Hi,
At the moment, there is the base error class
and then all the others inherit from that and add the two attributes
status_code
andmessage
. In the docs, you suggest the following handler:which uses the error's attributes. Technically, the annotated type does not have these attributes.
I don't know why you chose this design but I would like to make a PR to change it to:
and then change all others to the following init:
The text was updated successfully, but these errors were encountered: