SQLActionException sqlActionException = null;
builder.field("message", detailedMessage(t));
if (t instanceof SQLActionException) {
sqlActionException = (SQLActionException)t;
builder.field("code", sqlActionException.errorCode());
} else {
builder.field("code", 5000);
}
builder.endObject();