details.summary.format("%s failed with an exception.", granularity);
fillInFailureResolution(details);
if (failure instanceof LocationAwareException) {
final LocationAwareException scriptException = (LocationAwareException) failure;
details.failure = scriptException.getCause();
if (scriptException.getLocation() != null) {
details.location.text(scriptException.getLocation());
}
scriptException.visitReportableCauses(new TreeVisitor<Throwable>() {
int depth;
@Override
public void node(final Throwable node) {
if (node == scriptException) {
details.details.text(getMessage(scriptException.getCause()));
} else {
details.details.format("%n");
StringBuilder prefix = new StringBuilder();
for (int i = 1; i < depth; i++) {
prefix.append(" ");