output.append(500);
final StringBuilder msg = new StringBuilder(message.length());
HttpQuery.escapeJson(message, msg);
output.append(",\"message\":\"").append(msg.toString()).append("\"");
if (query.showStackTrace()) {
ThrowableProxy tp = new ThrowableProxy(exception);
tp.calculatePackagingData();
final String pretty_exc = ThrowableProxyUtil.asString(tp);
final StringBuilder trace = new StringBuilder(pretty_exc.length());
HttpQuery.escapeJson(pretty_exc, trace);
output.append(",\"trace\":\"").append(trace.toString()).append("\"");
}