1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00
node-red/packages/node_modules/@node-red/nodes/examples/function/function/05 - Handling errors.json
2020-06-24 14:43:27 +01:00

1 line
1.8 KiB
JSON

[{"id":"89c17d21.15da2","type":"inject","z":"dca895d.18be468","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":180,"y":120,"wires":[["1bcca7af.619428"]]},{"id":"3b9cd70e.8e66e8","type":"debug","z":"dca895d.18be468","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":530,"y":120,"wires":[]},{"id":"f76ea68a.6f3c58","type":"comment","z":"dca895d.18be468","name":"handling errors","info":"Calling `node.error` function with the original message as a second argument, function node can trigger a catch node in the same tab.\n\nSee Node-RED user guide about [functions](https://nodered.org/docs/user-guide/writing-functions).","x":140,"y":60,"wires":[]},{"id":"1bcca7af.619428","type":"function","z":"dca895d.18be468","name":"report error","func":"// In function node, calling node.error functions with the original input message as its second argument triggers catch node\n// See debug sidebar and console output\nnode.error(\"Oh no, something bad happened\", msg);\n// execution should stops here","outputs":1,"noerr":0,"initialize":"","finalize":"","x":350,"y":120,"wires":[["3b9cd70e.8e66e8"]]},{"id":"74854950.d99558","type":"catch","z":"dca895d.18be468","name":"","scope":["1bcca7af.619428"],"uncaught":false,"x":330,"y":180,"wires":[["32743f74.e718a"]]},{"id":"32743f74.e718a","type":"debug","z":"dca895d.18be468","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":510,"y":180,"wires":[]},{"id":"fb884166.e42f3","type":"comment","z":"dca895d.18be468","name":"↑ error information can be found in msg.error","info":"","x":630,"y":220,"wires":[]}]