-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
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
feat: exceptions for auth errors 400, 401, 403 #230
Conversation
failing linting tests in |
I really like this, thanks!! I have some concerns about backwards compatibility, since I'd prefer not to major bump again 😁 Could we ensure that the old Something like this, I think would work? class InvalidAuth(HTTPException):
...
class ForbiddenHttp(InvalidAuth, HTTPException):
...
Ignore. I'll look into this another time. It won't block merge 😊 |
Ah sure, compatibility was not on my radar. I liked your implementation idea but we would change the interface of # old InvalidAuth
def InvalidAuth(detail: str, request: HTTPConnection) -> UnauthorizedHttp | UnauthorizedWebSocket:
if request.scope['type'] == 'http':
return UnauthorizedHttp(detail) # new exception
return UnauthorizedWebSocket(detail) # new exception I also tried to add a new test module specific to this. And I added markers / TODO for the v6.0.0 release, not sure if ok! |
Hey @davidhuser , so sorry for the lack of review - I'll get it done this weekend. First look looks good though, same with your implementation around exceptions and backwards compatibility! 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks very good. Thanks for also fixing CONTRIBUTING.md
!! 😊
I've created a new release. Thanks again for all the effort you've put into helping me out with this library! |
related to #229
starlette.request
type (http or websocket)