Skip to content

Conversation

SandraRodgers
Copy link
Contributor

I found that the general Exception being thrown in line 194 gave confusing info.

I did some research and found that it's not common to raise an exception for a normal closure of a WebSocket connection with a close code of 1000. A close code of 1000 indicates a normal closure, where the connection is being closed gracefully. Raising an exception for a normal closure might be confusing and goes against the typical use of exceptions to signal errors or exceptional conditions. In the code as it was before, the exception handling seems to be used more for control flow (to exit the listening thread) rather than to handle an error.

So I opted to use ConnectionClosedOK which is a specific exception class for handling a normal closure with a close code of 1000. This means the exception will be handled for just this specific acceptable outcome, and the user will see the notice message but not see an error.

@davidvonthenen davidvonthenen merged commit d6a53da into main Jan 17, 2024
@davidvonthenen davidvonthenen deleted the sr/fix-issue-254 branch January 17, 2024 01:20
@davidvonthenen
Copy link
Contributor

yay! thanks for taking care of this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants