Ejecta icon indicating copy to clipboard operation
Ejecta copied to clipboard

How to catch global Error in JS ?

Open finscn opened this issue 10 years ago • 2 comments

Like title says.

as same as window.onerror in Browser

Thanks.

finscn avatar Dec 23 '15 13:12 finscn

What's your use case? I thought window.onerror is considered bad practice nowadays.

It could be added to the EJJavaScriptView's logException method, calling a function on the windowEventsDelegate. But we can't use Ejecta's usual triggerEvent function for this, because window.onerror expects some more parameters instead of just an event object. See https://developer.mozilla.org/en-US/docs/Web/API/GlobalEventHandlers/onerror#window.onerror

I'm not a fan :/

phoboslab avatar Dec 23 '15 22:12 phoboslab

Sometimes, an uncaught exception will make the game be frozen , I hope the game could be reload or do something else .

finscn avatar Dec 24 '15 07:12 finscn