window.onerror and try/catch
by zoho
HTML
<div id="result1">
hello
</div>
<div id="result2">
world
</div>
JavaScript
window.onerror = function myErrorHandler(errorMsg, url, lineNumber) {
console.log(errorMsg, url, lineNumber);
$("#result2").html("onerror");
return false;
}
try {
aaaa(1)
} catch(error) {
$("#result1").html("try/catch");
} finally {
}
aaaa(2);