private Element formatStackTrace(JsonArray<StackTraceItem> stackTrace) {
Element stackTraceElement = Elements.createDivElement(css.consoleStackTrace());
for (int i = 0, n = stackTrace.size(); i < n; ++i) {
StackTraceItem item = stackTrace.get(i);
Element itemElement = Elements.createDivElement(css.consoleStackTraceItem());
itemElement.appendChild(
formatLocationLink(item.getUrl(), item.getLineNumber(), item.getColumnNumber()));
itemElement.appendChild(Elements.createTextNode(
StringUtils.ensureNotEmpty(item.getFunctionName(), "(anonymous function)")));
stackTraceElement.appendChild(itemElement);
}