If you require to log/capture errors and create an error report, please follow the instructions below:
Illustrated in the image below is an example of a flow that has a Record Generator as a source step and it throws/returns an error from the Calculator step. The error and record gets stored in an event buffer that can be queried.
The example in the Calculator step as shown in the image below will throw/return as an error.
There are two types of Event Buffers that can be used to store the errors and records. They are the Record Event Buffer step and the Run Event Buffer step.
- To add an Event Buffer step, click on the last plus icon (+) at the end of the flow as highlighted in the below image. Select the Record/Run Event Buffer and add the buffer.
RecordEvent Buffer step:
This buffer stores the record information for a processed run. The data gets stored on MongoDB.
Select/tick the required event/s to store in the buffer, then select an existing buffer or create a new buffer as shown in the page below. The maximum number of records that can be stored in the buffer is set to 100 as a default and it can be increased.
NB: Ticking Clean Record will remove the record details.
The below payload shows the fields that get stored in the Record Event Buffer.
[
{
"_id": "645b42d964ab55a91ae85659",
"recordType": "record",
"record": {
"Id": 323,
"Category": "Fish",
"Food Item": "Anchovies, canned in oil, drained solids",
"Measure": 2,
"Calories": 17,
"Protein": 2,
"Fat": 1,
"Carbs": 0,
"Fibre": null
},
"runId": "645b42d9d9873",
"type": "record",
"status": {
"current": "Error",
"date": "2023-05-10T07:08:09.589Z"
},
"stepId": "a3ec9b22-dba6-4196-aef8-02d4771e7c6f",
"error": {
"message": "Error running calculation",
"statusCode": 400,
"error": "This is a sample error",
"errorMessage": null
},
"flowId": "6454d25278f3",
"flowVersion": null,
"parameters": null,
"flowName": "demo-docfusion--error-logging",
"_dateUpdated": "2023-05-10T07:08:09.595Z"
}
]
RunEvent Buffer step:
This buffer stores the run information of a processed run.
Select/tick the required event/s to store in the buffer, then select an existing buffer or create a new buffer as illustrated in the below image.
The below payload shows the fields that get stored in the Run Event Buffer.
[
{
"_id": "645b4258c2c55011daf4937c",
"event": "Completed with Errors",
"data": {
"run": {
"_id": "645b4258d9873c3db2b7ec8f",
"batchId": null,
"processId": null
},
"flow": {
"_id": "6459025bd9873c",
"name": "error-logging",
"title": "Demo> Error Logging-Run"
},
"solution": {
"_id": "6437c2760171",
"name": "usersolutions",
"title": "UserSolutions"
},
"headers": [],
"footers": [],
"parameters": {},
"org": {
"name": "orgname",
"title": "orgname"
},
"error": null,
"stats": {
"processingDates": {
"created": "2023-05-10T07:06:00.839Z",
"started": "2023-05-10T07:06:00.840Z",
"actions": "2023-05-10T07:06:00.847Z",
"completed": null
},
"recordStats": {
"errors": 1,
"total": 1,
"completed": 0,
"headers": 0,
"footers": 0,
"skipped": 0
}
}
},
"type": "run",
"runId": "645b4258d9873",
"flowId": "6459025bd987",
"flowVersion": null,
"_dateUpdated": "2023-05-10T07:06:00.850Z"
}
]
- Create a flow to query the buffer and email the error report which is an Excel file.
Illustrated in the below flow is a Buffer Query source step to retrieve the error data from the buffer, create an Excel file and send the file as an email attachment.
The Buffer Query source step is used to write a SQL query to return the required fields from the buffer as illustrated in the image below.
N.B: Each field name in the buffer needs to have an alias field name to ensure that there is no conflict when querying the buffer due to a run’s default field names.
The below image shows the returned results from the Buffer Query source step.
An Excel file gets created with the payload and emailed to a recipient using the Email destination step.