def next(self):
        __traceback_supplement__ = (
            Supplement, self.error_middleware, self.environ)
        if self.closed:
            raise StopIteration
        try:
            return self.app_iterator.next()
        except __HOLE__:
            self.closed = True
            close_response = self._close()
            if close_response is not None:
                return close_response
            else:
                raise StopIteration
        except:
            self.closed = True
            close_response = self._close()
            exc_info = sys.exc_info()
            response = self.error_middleware.exception_handler(
                exc_info, self.environ)
            if close_response is not None:
                response += (
                    '<hr noshade>Error in .close():<br>%s'
                    % close_response)

            if not self.start_checker.response_started:
                self.start_checker('500 Internal Server Error',
                               [('content-type', 'text/html')],
                               exc_info)

            if six.PY3:
                response = response.encode('utf8')
            return response
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Paste-2.0.1/paste/exceptions/errormiddleware.py/CatchingIter.next