Handle exceptions in main loop.