js catch errors on listeners

Solutions on MaxInterview for js catch errors on listeners by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "js catch errors on listeners"
Isabell
12 Apr 2020
1// If you would like to access errors thrown from event handlers, 
2// you may listen to the error event on window.
3// It will be emitted for all uncaught errors in the current JavaScript VM:
4window.addEventListener('error', function(event) {
5  console.log("Got an uncaught error: ", event.error)
6})
7