NativeScript / ios-jsc

NativeScript for iOS using JavaScriptCore

Home Page:http://docs.nativescript.org/runtimes/ios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add OnDiscardedError handler

vtrifonov opened this issue · comments

Is your feature request related to a problem? Please describe.
Currently we have a custom flag which can be used to avoid application crashes when JS exceptions are thrown discardUncaughtJsExceptions. Unfortunately those type of exceptions cannot be collected through analytics, so it would be good if we can provide a way of handling such exceptions so that you could be able to get more details about where and how often they happen.

Describe the solution you'd like
Adding __onDiscardedError similar to __onUncaughtError handler which will receive those exceptions can be useful to process them, e.g.:

global.__onDiscardedError = function(error){
    console.log(error.message);
    console.log(error.stackTrace);
    console.log(error.nativeException);
    //report the exception in your analytics solution here
}