Skip to content
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

Onerrror handler's argument should use Event, not ErrorEvent #7

Open
ctm opened this issue Jul 31, 2024 · 0 comments
Open

Onerrror handler's argument should use Event, not ErrorEvent #7

ctm opened this issue Jul 31, 2024 · 0 comments

Comments

@ctm
Copy link
Contributor

ctm commented Jul 31, 2024

EventClient::set_on_error should take a Option<Box<dyn Fn(Event)>>, not a Option<Box<dyn Fn(ErrorEvent)>>.

Calling any of the ErrorEvent specific methods (e.g., message) from within an onerror handler causes programs to die. Calling Event specific methods (e.g., type_, time_stamp) work fine. According to MDN, the type of the error event is "A generic Event".

FWIW, there's a chance that an ErrorEvent has been passed in the past, because I have some code from January 2022 that calls .message() that I think used to work. It's hard for me to be sure that it worked, because it's in error handling code that rarely gets called. I certainly would like to think that I'd have noticed it if it has been broken for two and a half years, but I can't guarantee that.

ctm added a commit to ctm/wasm-sockets that referenced this issue Jul 31, 2024
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

No branches or pull requests

1 participant