// Tks to http://stackoverflow.com/a/13435462

window.onerror = function (msg, url, line) {
    console.log("Caught[via window.onerror]: '" + msg + "' from " + url + ":" + line);
    return true; // same as preventDefault
};

window.addEventListener('error', function (evt) {
    console.log("Caught[via 'error' event]:  '" + evt.message + "' from " + evt.filename + ":" + evt.lineno);
    console.log(evt); // has srcElement / target / etc
    evt.preventDefault();
});

Add basic error catching handler
Add basic error catching handler
