def handle_exception(self, exception, debug_mode):
    if issubclass(exception.__class__, models.Error):
      self.AUDIT_LOG_MODEL.Log(
          successful=False, message=exception.message, request=self.request)

      exc_type, exc_value, exc_tb = sys.exc_info()
      tb = traceback.format_exception(exc_type, exc_value, exc_tb)
      logging.warning('handle_exception: %s', ''.join(tb))

      self.error(exception.error_code)
      if issubclass(exception.__class__, models.AccessDeniedError):
        self.response.out.write('Access denied.')
      else:
        self.response.out.write(cgi.escape(exception.message))
    else:
      super(AccessHandler, self).handle_exception(exception, debug_mode)
Handle an exception.
dataset/ETHPy150Open google/cauliflowervest/src/cauliflowervest/server/handlers/__init__.py/AccessHandler.handle_exception