def _handle_run_exception(self, exc):
self.raise_exception(exc, self._current_tups)<EOL>if self.auto_fail:<EOL><INDENT>failed = set()<EOL>for key, batch in iteritems(self._batches):<EOL><INDENT>if self.exit_on_exception or key == self._current_key:<EOL><INDENT>for tup in batch:<EOL><INDENT>self.fail(tup)<EOL>failed.add(tup.id)<EOL><DEDENT><DEDENT><DEDENT>for tup in self._current_tups:<EOL><INDENT>if tup.id not in failed:<EOL><INDENT>self.fail(tup)<EOL><DEDENT><DEDENT>self._batches[self._current_key] = []<EOL>self._current_key = None<EOL><DEDENT>
Process an exception encountered while running the ``run()`` loop.

        Called right before program exits.