Slide 12
Slide 12 text
Global error handler
// Old school
window.onerror = function(message, source, lineno, colno,
error) {
…
};
window.addEventListener(‘error’, function(event) {
// event.message
// event.filename
// event.lineno
// event.colno // good browsers only
// event.error (has stack property, in good browsers)
}, true);
…or by listening to the window ‘error’
event. Listen with capture=true to also get
notified of resource load errors
Errors are easily caught in window.onerror