js catch errors on listeners

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

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