set exit code on detecting errors