Overwolf doesn't call onUncaughtException callback

Hey,

I am trying to add a listener to overwolf.extensions.onUncaughtException in my background controller to see any uncaught exceptions in my windows.
I want this because it will enable better UX on my app => when app crashes, I log the error on my backend, then restart the app and show a pop-up on user that we know about the situation and we’ll fix it ASAP.

Can you reproduce it (exact steps to reproduce):
overwolf.extensions.onUncaughtException.addListener((e) => {console.log(e)})

Do you currently have a workaround?
Not really, but I’m open for ideas.

Hi,

  • ovewrolf.extensions.onUncaughtException will only capture js errors (not app crashes), that were not caught by your own code (try… catch…)

  • ovewrolf.extensions.onUncaughtException will only capture js errors that occur on your app’s process (i.e. if you are running ads, you won’t catch js errors from the ad iframes)

  • ovewrolf.extensions.onUncaughtException works only in the scope of the window it was called on.
    So, your background window will not catch uncaught exceptions from other windows of your app - you’ll have to set this on each window (and then you can forward it to your background window via overwolf.windows.getMainWindow).

Hey,

Yeah, any exception that is not catched by me will make my app unstable (it can not read some info from backend that is mandatory for instance) and I want it to write on localStorage that something happened, then relaunch the app. On relaunch, the app will see if there is something about a previous exception in localStorage, upload some info about it to my backend, then a pop-up will appear to user where we tell him that the issue is being investigated.

I tried setting up those exception listeners on my other windows and manually creating an exception (accessing an undefined property) and my window will just stop working (I made sure that I am subscribed to the event before triggering the exception) and nothing is written to my localStorage.
Should I try to subscribe to the event and then send the exception directly to my main window instead of trying to do some more actions in the window that had the exception?

try with a setTimeout (since you are typing it into the dev tools console, it won’t work otherwise)

setTimeout(() => { a.bbb.c = 123 }, 10);