Ejemplo n.º 1
0
  def ReportWarning(self, warning_message, status=200):
    """Reports a warning to the client and logs the warning.

    Args:
      warning_message: The warning message to log (as an error).
      status: The http response code to use.
    """
    logging.warning(warning_message)
    self.response.set_status(status)
    self.response.out.write('%s\nrequest_id:%s\n' %
                            (warning_message, utils.GetRequestId()))
Ejemplo n.º 2
0
  def ReportError(self, error_message, status=500):
    """Reports the given error to the client and logs the error.

    Args:
      error_message: The message to log and send to the client.
      status: The HTTP response code to use.
    """
    logging.error(error_message)
    self.response.set_status(status)
    self.response.out.write('%s\nrequest_id:%s\n' %
                            (error_message, utils.GetRequestId()))