I have the following code:
var test = {
func1: function() {...},
func2: function() {...},
func3: function() {...}
};
Now, I want to be able to catch any exceptions that might be thrown inside of func1/2/3. Is there an elegant way to do this without having to insert a try catch in each function?
Each function makes a call to a 3rd party library, so using window.onerror just gives me a very generic Script error, which I can't really use (due to cross origin issue apparently).
The code executes within a WebBrowser control in WPF, where the browser is targeting IE10. I'm not allowed to use anything but pure javascript and jQuery.
Whenever an exception is caught I propagate it further on to the underlying viewmodel which then logs it on the server.