final String reasonString = errorCode.toString() + ":" + errorCode.getReasonString();
if (e != null) { Logger.error(reasonString, e); }
else { Logger.error(reasonString); }
ObjectNode obj = new ObjectNode(JsonNodeFactory.instance);
obj.put("result", "error");
obj.put("reason", errorCode.getReasonString());
if (additionalInfo != null) {
ObjectNode info = new ObjectNode(JsonNodeFactory.instance);
for (Entry<String, String> entry : additionalInfo.entrySet())
info.put(entry.getKey(), entry.getValue());
obj.put("additional", info);
}
return renderJSON(obj, INTERNAL_SERVER_ERROR);
}