Catching uncaught exceptions in js