'Log current error, and send error output to client if possible'

def handle_error(self):

    self.log_exception(sys.exc_info())
    if (not self.headers_sent):
        self.result = self.error_output(self.environ, self.start_response)
        self.finish_response()
