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.
EventClient::set_on_error
should take aOption<Box<dyn Fn(Event)>>
, not aOption<Box<dyn Fn(ErrorEvent)>>
.Calling any of the
ErrorEvent
specific methods (e.g.,message
) from within an onerror handler causes programs to die. CallingEvent
specific methods (e.g.,type_
,time_stamp
) work fine. According to MDN, the type of the error event is "A genericEvent
".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.