I have several flows, with subflows and nest subflows. Any of these flows can have a join (not always with a split). All these flows do lots of different things, mostly in parallel. All the flows eventually join up and when all are done, provides a single response back to the user.
What I need to do is track any errors that occur along the way, consolidate them in the end, and return them to the user.
The problem is when flows split (using the split node or not), the global, flow and node contexts are duplicated, as is the msg object. If I don't do anything to consolidate data, the last flow to enter the join node provides the contexts and msg object. So there is no place to store errors in the flows, that I can consolidate, since msg is being used for actual data, and its very awkward to put errors in there too.
I thought of storing errors in global, or flow but as those are duplicate like msg, and can't merge those, they don't help.
I don't know if this is clear enough. Has anyone needed to do something similar and found a solution?
Code is my attempt to use global context but see that it was duplicated as well.
[
{
"id": "c300468d.039678",
"type": "inject",
"z": "57ffe4f8.972bcc",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 200,
"wires": [
[
"fd2a4a0e.fcdba8"
]
]
},
{
"id": "3957735c.17df5c",
"type": "change",
"z": "57ffe4f8.972bcc",
"name": "",
"rules": [
{
"t": "set",
"p": "warnings",
"pt": "global",
"to": "$append(\t $globalContext('warnings'),\t 'warning A'\t)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 630,
"y": 180,
"wires": [
[
"dedd415a.76faf"
]
]
},
{
"id": "fd2a4a0e.fcdba8",
"type": "change",
"z": "57ffe4f8.972bcc",
"name": "",
"rules": [
{
"t": "set",
"p": "warnings",
"pt": "global",
"to": "[]",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 390,
"y": 200,
"wires": [
[
"3957735c.17df5c",
"8eddde95.b22da",
"b394f589.28f4f8"
]
]
},
{
"id": "8eddde95.b22da",
"type": "change",
"z": "57ffe4f8.972bcc",
"name": "",
"rules": [
{
"t": "set",
"p": "warnings",
"pt": "global",
"to": "$append(\t $globalContext('warnings'),\t 'warning B'\t)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 630,
"y": 240,
"wires": [
[
"dedd415a.76faf"
]
]
},
{
"id": "dedd415a.76faf",
"type": "join",
"z": "57ffe4f8.972bcc",
"name": "",
"mode": "custom",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "3",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 840,
"y": 220,
"wires": [
[
"62e82f73.122ad"
]
]
},
{
"id": "b394f589.28f4f8",
"type": "change",
"z": "57ffe4f8.972bcc",
"name": "",
"rules": [
{
"t": "set",
"p": "warnings",
"pt": "global",
"to": "$append(\t $globalContext('warnings'),\t 'warning C'\t)",
"tot": "jsonata"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 630,
"y": 300,
"wires": [
[
"dedd415a.76faf"
]
]
},
{
"id": "62e82f73.122ad",
"type": "debug",
"z": "57ffe4f8.972bcc",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 990,
"y": 220,
"wires": []
}
]