-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Replace RuntimeError with WebSocketDisconnected #2767
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
base: master
Are you sure you want to change the base?
Replace RuntimeError with WebSocketDisconnected #2767
Conversation
class WebSocketDisconnected(RuntimeError): | ||
""" | ||
Raised when attempting to use a disconnected WebSocket. | ||
""" | ||
|
||
pass |
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.
That's not really what I meant... The exception already exists.
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.
Well, reading the code, WebSocketDisconnect
seems to be called when you want to disconnect a socket, in these cases the socket is already disconnected. In my opinion, it would make more sense to create a new exception (WebSocketDisconnected
). Tell me if you still want to use WebSocketDisconnect
and if so I will make such changes.
The change suggested by @ruitcatarino looks meaningful to me. What stands in the way of accepting this change, can we somehow help? |
After the revival of this MR, which, to be honest, I have revisited sporadically in the hopes of getting an update, since my team and I at work are still affected by the original issue that led me to create this pull request, I realized that this newly created exception could also be used in the following cases: |
…eive_text and receive_json
Summary
Change the exception raised if we attempt to use a disconnected WebSocket from
RuntimeError
toWebSocketDisconnected
.Discussed in #2762
Issue #2766
Checklist
I haven't changed the documentation, if there is a need for it I will gladly change it.