Adding logging for uncaught exceptions