Add uncaught exception handler to threads.