Handle uncaught exceptions.