python-trio / trio-websocket

WebSocket client and server implementation for Python Trio
MIT License
70 stars 26 forks source link

can't discern connect vs. disconnect timeout #116

Closed belm0 closed 5 years ago

belm0 commented 5 years ago

When there is a timeout raising TooSlowError, it's not obvious how to discern between connect and disconnect timeout for logging or raising a detailed error.

Perhaps trio-websocket should have a custom exception for timeout.

belm0 commented 5 years ago

more importantly, the user may want to treat the cases separately (e.g. pass on disconnect timeout)

belm0 commented 5 years ago

Another reason not to use TooSlowError: if the user employs fail_after() within the open_websocket() context for any purpose, he can't discern between trio-websocket connection timeouts and his app's own errors.