Skip to content

Commit

Permalink
Fix error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
moellenbeck committed Nov 14, 2024
1 parent 08b6df8 commit 9244da5
Show file tree
Hide file tree
Showing 6 changed files with 368 additions and 279 deletions.
39 changes: 20 additions & 19 deletions endevent-finished-listener.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,37 @@ module.exports = function (RED) {
}

let currentIdentity = node.engine.identity;
let subscription = await client.events.onEndEventFinished(
(endEventFinished) => {
node.send({
payload: endEventFinished,
});
},
{ identity: currentIdentity },
).catch((error) => {
node.error(error);
});

node.engine.registerOnIdentityChanged(async (identity) => {
client.events.removeSubscription(subscription, currentIdentity);

currentIdentity = identity;
let subscription = null;

try {
subscription = await client.events.onEndEventFinished(
(endEventFinished) => {
node.send({
payload: endEventFinished
payload: endEventFinished,
});
},
{ identity: currentIdentity },
).catch((error) => {
node.error(error);
);

node.engine.registerOnIdentityChanged(async (identity) => {
client.events.removeSubscription(subscription, currentIdentity);

currentIdentity = identity;

subscription = await client.events.onEndEventFinished(
(endEventFinished) => {
node.send({
payload: endEventFinished
});
},
{ identity: currentIdentity },
);
});

}).catch((error) => {
} catch (error) {
node.error(error);
});
}

node.on('close', async () => {
if (node.engine && node.engine.engineClient && client) {
Expand Down
121 changes: 104 additions & 17 deletions nodered/flows.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
"fc23f271b106648f"
],
"x": 34,
"y": 259,
"y": 239,
"w": 652,
"h": 202
},
Expand Down Expand Up @@ -467,6 +467,30 @@
"w": 572,
"h": 142
},
{
"id": "3f3c01daebb2d215",
"type": "group",
"z": "fd3c725340de4f74",
"style": {
"stroke": "#999999",
"stroke-opacity": "1",
"fill": "none",
"fill-opacity": "1",
"label": true,
"label-position": "nw",
"color": "#a4a4a4"
},
"nodes": [
"2fadb4c4667ecaf2",
"93331783b7ef3fc5",
"bc26f9821540f097",
"cc3fb9c2cb0edd3a"
],
"x": 34,
"y": 459,
"w": 552,
"h": 142
},
{
"id": "42e6796dddd9d4db",
"type": "processcube-engine-config",
Expand All @@ -479,17 +503,6 @@
"name": "Engine Auth 8000",
"url": "http://engine:8000"
},
{
"id": "392373f3e1403770",
"type": "processcube-engine-config",
"name": "",
"url": "http://host.docker.internal:56000",
"urlType": "str",
"clientId": "",
"clientIdType": "str",
"clientSecret": "",
"clientSecretType": "str"
},
{
"id": "2991a5e6df2b87d2",
"type": "externaltask-input",
Expand All @@ -498,6 +511,8 @@
"name": "Test",
"engine": "42e6796dddd9d4db",
"topic": "Test",
"workerConfig": "{}",
"workerConfigType": "json",
"x": 110,
"y": 180,
"wires": [
Expand Down Expand Up @@ -550,6 +565,8 @@
"name": "SampleError",
"engine": "42e6796dddd9d4db",
"topic": "SampleError",
"workerConfig": "{}",
"workerConfigType": "json",
"x": 130,
"y": 360,
"wires": [
Expand Down Expand Up @@ -809,6 +826,8 @@
"name": "Test_Auth",
"engine": "b78932d162d8d468",
"topic": "Test_Auth",
"workerConfig": "{}",
"workerConfigType": "json",
"x": 120,
"y": 180,
"wires": [
Expand Down Expand Up @@ -872,6 +891,8 @@
"name": "SampleError_Auth",
"engine": "b78932d162d8d468",
"topic": "SampleError_Auth",
"workerConfig": "{}",
"workerConfigType": "json",
"x": 150,
"y": 360,
"wires": [
Expand Down Expand Up @@ -1131,7 +1152,7 @@
"query": "payload",
"query_type": "msg",
"x": 180,
"y": 420,
"y": 400,
"wires": [
[
"8ef39e83173d41e3"
Expand All @@ -1152,7 +1173,7 @@
"finalize": "",
"libs": [],
"x": 390,
"y": 420,
"y": 400,
"wires": [
[
"f524b8cc35d56849"
Expand All @@ -1169,7 +1190,7 @@
"result": "payload.result",
"result_type": "msg",
"x": 580,
"y": 420,
"y": 400,
"wires": [
[]
]
Expand All @@ -1182,7 +1203,7 @@
"name": "Demo to listen on a new usertask an finish them",
"info": "",
"x": 240,
"y": 300,
"y": 280,
"wires": []
},
{
Expand All @@ -1197,7 +1218,7 @@
"query": "{}",
"query_type": "json",
"x": 160,
"y": 360,
"y": 340,
"wires": [
[
"f7c7682e3a6adaaa"
Expand Down Expand Up @@ -1242,6 +1263,72 @@
]
]
},
{
"id": "2fadb4c4667ecaf2",
"type": "usertask-input",
"z": "fd3c725340de4f74",
"g": "3f3c01daebb2d215",
"name": "",
"engine": "42e6796dddd9d4db",
"query": "{\"flowNodeId\":\"gibt_es_nicht\"}",
"query_type": "json",
"sendtype": "array",
"x": 300,
"y": 560,
"wires": [
[
"bc26f9821540f097"
]
]
},
{
"id": "93331783b7ef3fc5",
"type": "inject",
"z": "fd3c725340de4f74",
"g": "3f3c01daebb2d215",
"name": "",
"props": [],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 130,
"y": 560,
"wires": [
[
"2fadb4c4667ecaf2"
]
]
},
{
"id": "bc26f9821540f097",
"type": "debug",
"z": "fd3c725340de4f74",
"g": "3f3c01daebb2d215",
"name": "debug 34",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 480,
"y": 560,
"wires": []
},
{
"id": "cc3fb9c2cb0edd3a",
"type": "comment",
"z": "fd3c725340de4f74",
"g": "3f3c01daebb2d215",
"name": "Search UserTasks",
"info": "",
"x": 150,
"y": 500,
"wires": []
},
{
"id": "c4f20aefe585bdad",
"type": "comment",
Expand Down
Loading

0 comments on commit 9244da5

Please sign in to comment.