snapview/tungstenite-rs

Document when functions can fail.

dev-ardi opened this issue · 1 comments

There are functions such as WebSocket::read and tungstenite::accept that are unclear what conditions it can fail. Yes, it returns a tungstenite::Error and a HandsakeError which must be managed but it would be nice if it specified the error conditions a bit.

We tried to address it in the past as best as we could (back when we had several PRs that extended the documentation for the functions and the error enum). I doubt we would describe all of the possible error conditions for the aforementioned functions, plainly because e.g. WebSocket::read is a very high-level function, so there are lots of reasons it might fail. Listing them one by one would essentially be a copy-paste of the error enum.

But if you have some concrete suggestions or if I understood your request wrong, feel free to re-open or create a PR 🙂