Skip to content

More explicit error message when redirected to a non websocket uri #1632

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

anthony-moreau
Copy link

When using the asyncio client, the error message and exception raised is the same if the user provides an incorrect uri or if the server respondes with a 302 found with a location header pointing to an incorrect uri.

This is quite confusing as it took me some time and debugging of the websocket library to figure out that the problem wasn't directly in my code but rather in the response of the server.

The current behavior isn't a bug as the uri was indeed a webpage and not a websocket so an exception in this scenario is normal. However a more explicit error message would help users understand the exact issue better.

As a result I'm suggesting changes to catch the InvalidUri exception in this scenario and modify the error message to make it more explicit. I also added a test to reflect theses changes.

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

Successfully merging this pull request may close these issues.

2 participants