oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.77k stars 2.55k forks source link

WebSockets documentation includes nonexistent "error" handler #11634

Open KirillTregubov opened 3 weeks ago

KirillTregubov commented 3 weeks ago

What is the type of issue?

Documentation is incorrect

What is the issue?

In the WebSockets reference in the documentation, it lists an "error" handler here. However, there are no types for it, and it doesn't seem to do anything when I try to define it in Bun.

Please either update the types to include it (if it exists), or update the reference.

Where did you find it?

https://github.com/oven-sh/bun/blob/main/docs/api/websockets.md?plain=1#L325 https://bun.sh/docs/api/websockets#reference

kevinmarrec commented 2 weeks ago

Just have been playing with Bun WebSockets and also have been surprised by not having autocompletion on websocket.error in IDE.

Indeed the types do not exist, while the documentation is saying something different, and we would like to know if WebSocket errors are handled by Bun or not.