"""
self.exc_infos = exc_infos if exc_infos else []
if not message:
- # By default, print the type and string of each ExceptInfo object.
- message = '\n'.join(['%s: %s' % (e.type, e.str) for e in self.exc_infos])
+ # By default, print all stored ExceptInfo objects. This is the
+ # preferred behavior because we'd always have the full
+ # tracebacks to debug the failure.
+ self.message = '\n'.join(['{e.type}: {e.str}\n{e.traceback}'.format(e=ex)
+ for ex in self.exc_infos])
super(CompoundFailure, self).__init__(message=message)
- def ToFullMessage(self):
- """Returns a string with all information in self.exc_infos."""
+ def ToSummaryString(self):
+ """Returns a string with type and string of each ExceptInfo object.
+
+ This does not include the textual tracebacks on purpose, so the
+ message is more readable on the waterfall.
+ """
if self.HasEmptyList():
# Fall back to return self.message if list is empty.
return self.message
else:
- # This includes the textual traceback(s).
- return '\n'.join(['{e.type}: {e.str}\n{e.traceback}'.format(e=ex) for
- ex in self.exc_infos])
+ return '\n'.join(['%s: %s' % (e.type, e.str) for e in self.exc_infos])
def HasEmptyList(self):
"""Returns True if self.exc_infos is empty."""
class BuildFailureMessage(object):
"""Message indicating that changes failed to be validated."""
- def __init__(self, message, tracebacks, internal, reason):
+ def __init__(self, message, tracebacks, internal, reason, builder):
"""Create a BuildFailureMessage object.
Args:
tracebacks: Exceptions received by individual builders, if any.
internal: Whether this failure occurred on an internal builder.
reason: A string describing the failure.
+ builder: The builder the failure occurred on.
"""
# Convert each of the input arguments into simple Python datastructures
# (i.e. not generators) that can be easily pickled.
self.tracebacks = tuple(tracebacks)
self.internal = bool(internal)
self.reason = str(reason)
+ self.builder = str(builder)
def __str__(self):
return self.message