JS menangkap kesalahan pada pendengar

// If you would like to access errors thrown from event handlers, 
// you may listen to the error event on window.
// It will be emitted for all uncaught errors in the current JavaScript VM:
window.addEventListener('error', function(event) {
  console.log("Got an uncaught error: ", event.error)
})
Chris PA