Skip to content

Conversation

@Manas-sin
Copy link

Summary

Replaces the generic RuntimeError with WebSocketDisconnect (code 1006) when attempting to send or receive messages on a WebSocket connection that has already been closed.

This improves error handling by allowing applications to catch a specific exception type instead of relying on string matching for RuntimeError.

Fixes #2767.

Checklist

  • I understand that this PR may be closed in case there was no previous discussion. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly. (No doc changes needed for this internal fix, but tests are updated)

@Kludex
Copy link
Owner

Kludex commented Dec 31, 2025

But this doesn't make sense; the client isn't supposed to see those error messages.

Let's continue the discussion on the other PR.

@Kludex Kludex closed this Dec 31, 2025
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