Added pauseOnError function as requested by hajo4.