예제 #1
0
def TransformError(r, message=None):
    """Raises an Error exception that does not generate a stack trace.

  Args:
    r: A JSON-serializable object.
    message: An error message. If None then r is formatted as the error message.

  Raises:
    Error: This will not generate a stack trace.
  """
    raise resource_exceptions.Error(message if message is not None else str(r))
예제 #2
0
def TransformError(r, message=None):
    """Raises an Error exception that does not generate a stack trace.

  Args:
    r: A JSON-serializable object.
    message: An error message. If not specified then the resource is formatted
      as the error message.

  Raises:
    Error: This will not generate a stack trace.
  """
    if message is None:
        message = unicode(r)
    raise resource_exceptions.Error(message)