public static String constructErrorRecordString(ComplexEventChunk<StateEvent> eventChunk,
                                                    boolean isObjectColumnPresent, TableDefinition tableDefinition,
                                                    Exception e) {
        JsonObject payloadJson = new JsonObject();
        if (isObjectColumnPresent || e instanceof ConnectionUnavailableException) {
            payloadJson.addProperty("isEditable", false);
        } else {
            payloadJson.addProperty("isEditable", true);
        }
        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()) {
            StateEvent stateEvent = eventChunk.next();
            for (StreamEvent streamEvent : stateEvent.getStreamEvents()) {
                if (streamEvent != null) {
                    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