Quantcast
Channel: JavaScript global event mechanism - Stack Overflow
Viewing all articles
Browse latest Browse all 10

Answer by Aleksandr Oleynikov for JavaScript global event mechanism

$
0
0

If you want unified way to handle both uncaught errors and unhandled promise rejections you may have a look on uncaught library.

EDIT

<script type="text/javascript" src=".../uncaught/lib/index.js"></script><script type="text/javascript">    uncaught.start();    uncaught.addListener(function (error) {        console.log('Uncaught error or rejection: ', error.message);    });</script>

It listens window.unhandledrejection in addition to window.onerror.


Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>