public static String constructAddErrorRecordString(ComplexEventChunk<StreamEvent> eventChunk,
                                                       boolean isObjectColumnPresent, TableDefinition tableDefinition,
                                                       Exception e) {
        JsonObject payloadJson = new JsonObject();
        payloadJson.addProperty("isEditable", !(isObjectColumnPresent || e instanceof ConnectionUnavailableException));
        JsonArray attributes = new JsonArray();
        JsonArray records = new JsonArray();
        for (Attribute attribute : tableDefinition.getAttributeList()) {
            JsonObject attributeJson = new JsonObject();
            attributeJson.add("name", new JsonPrimitive(attribute.getName()));
            attributeJson.add("type", new JsonPrimitive(String.valueOf(attribute.getType())));
            attributes.add(attributeJson);
        }
        payloadJson.add("attributes", attributes);
        while (eventChunk.hasNext()) {
            StreamEvent streamEvent = eventChunk.next();
            JsonArray record = new JsonArray();
            for (Object item : streamEvent.getOutputData()) {
                if (item == null) {
                    record.add(JsonNull.INSTANCE);
                } else {
                    record.add(String.valueOf(item));
                }
            }
            records.add(record);
        }
        payloadJson.add("records", records);
        return payloadJson.toString();
    }
Contains utility methods for the error handler.
modules/siddhi-core/src/main/java/io/siddhi/core/util/error/handler/util/ErrorHandlerUtils.java