On goal failure, exit with correct error message and error code.