Subflow error source is not searchable

A subflow containing a function node throws an error.
The error is caught by a catch node in the flow where the subflow instance is placed.

The catch node shows the msg.error.source.id. However, we can;t search the id in the flow. I would believe that id belongs to the function node inside the instance of the subflow.

Issue: The problem with this is that when multiple subflow instances exist, it is impossible to find the source of error.

Possible resolution: The msg.error.source.id should show the value of the subflow isntance node id.

You can feed the catch node to an output on the subflow and then you can identify which subflow instance it is.

You mean I should catch the error inside the subflow? that doesnt make sense.

Here is a sample of how you could identify the subflow. Add a change node before calling the subflow and set msg.subflow with an id. In the subflow have a catch node output to what ever you want and you can look at msg.subflow to identify the one with the error.

[{"id":"92c501212dc80de3","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"ac694b799e60a6eb","type":"subflow","name":"Subflow 1","info":"","in":[{"x":182,"y":109,"wires":[{"id":"fcff780a52f6493d"}]}],"out":[{"x":533,"y":101,"wires":[{"id":"fcff780a52f6493d","port":0}]},{"x":538,"y":172,"wires":[{"id":"637894b7751611bf","port":0}]}]},{"id":"d16b9fac.8212a","type":"debug","z":"92c501212dc80de3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":781,"y":132,"wires":[]},{"id":"c5ee9670.5dbbd8","type":"inject","z":"92c501212dc80de3","name":"Trigger error","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"test 1","payloadType":"str","x":147,"y":101,"wires":[["cc86c223f2cca699"]]},{"id":"637894b7751611bf","type":"catch","z":"ac694b799e60a6eb","name":"","scope":["fcff780a52f6493d"],"uncaught":false,"x":347,"y":167,"wires":[[]]},{"id":"fcff780a52f6493d","type":"function","z":"ac694b799e60a6eb","name":"Throw Error","func":"node.error(\"an example error\", msg);   ","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":355,"y":97,"wires":[[]]},{"id":"dfb1a38fcfd261ec","type":"subflow:ac694b799e60a6eb","z":"92c501212dc80de3","name":"","x":521.5,"y":103,"wires":[["e941c954973d581b"],["d16b9fac.8212a"]]},{"id":"e941c954973d581b","type":"debug","z":"92c501212dc80de3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"error","targetType":"msg","x":796,"y":84,"wires":[]},{"id":"fd098cbc70720b21","type":"subflow:ac694b799e60a6eb","z":"92c501212dc80de3","name":"","env":[],"x":524.5,"y":237,"wires":[["dc78e17c9897392a"],["85425cc166c4ba62"]]},{"id":"98ec8d620681232f","type":"inject","z":"92c501212dc80de3","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":138.5,"y":238,"wires":[["c3c5cc98a3ab746b"]]},{"id":"dc78e17c9897392a","type":"debug","z":"92c501212dc80de3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":777.5,"y":209,"wires":[]},{"id":"85425cc166c4ba62","type":"debug","z":"92c501212dc80de3","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":772,"y":253,"wires":[]},{"id":"cc86c223f2cca699","type":"change","z":"92c501212dc80de3","name":"","rules":[{"t":"set","p":"subflow","pt":"msg","to":"copy 1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340.5,"y":103,"wires":[["dfb1a38fcfd261ec"]]},{"id":"c3c5cc98a3ab746b","type":"change","z":"92c501212dc80de3","name":"","rules":[{"t":"set","p":"subflow","pt":"msg","to":"copy 2","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":333,"y":238,"wires":[["fd098cbc70720b21"]]}]

Thanks for your example. It is a valid workaround.
But am looking to see how we can resolve this as part of the core development of NR

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.