hufftheweevil / node-red-contrib-persistent-fsm

A Node Red node that wraps around Javascript State Machine
Other
4 stars 7 forks source link

Transition error is not caught by Catch node #8

Closed colinl closed 1 year ago

colinl commented 2 years ago

I configured a state machine node and added a Catch node to catch errors, but if I send it an erroneous payload the Catch node does not catch it. The error message does show in the debug log. Is it intended that I should be able to catch it? Using fsm node 1.2.0, NR 3.0.2, nodejs 16.17.0

Example flow

[{"id":"48923fbe9da4d810","type":"catch","z":"3e6e1c87317d6268","name":"","scope":["5ae741363f50a810"],"uncaught":false,"x":290,"y":580,"wires":[["6592204c93b6511e"]]},{"id":"6592204c93b6511e","type":"debug","z":"3e6e1c87317d6268","name":"ERROR","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":460,"y":580,"wires":[]},{"id":"5ae741363f50a810","type":"state-machine","z":"3e6e1c87317d6268","name":"fsm error test","triggerProperty":"payload","triggerPropertyType":"msg","stateProperty":"payload","statePropertyType":"msg","initialDelay":"0","persistOnReload":true,"outputStateChangeOnly":true,"throwException":true,"states":["start","going"],"transitions":[{"name":"Reset","from":"*","to":"start"},{"name":"Go","from":"start","to":"going"}],"x":310,"y":520,"wires":[["e7f3d459f828f671"]]},{"id":"c85a77d947810d2c","type":"inject","z":"3e6e1c87317d6268","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Go","payloadType":"str","x":110,"y":520,"wires":[["5ae741363f50a810"]]},{"id":"0a25a7398acc3198","type":"inject","z":"3e6e1c87317d6268","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Reset","payloadType":"str","x":110,"y":480,"wires":[["5ae741363f50a810"]]},{"id":"9fd5f57603dc8996","type":"inject","z":"3e6e1c87317d6268","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Error","payloadType":"str","x":110,"y":580,"wires":[["5ae741363f50a810"]]},{"id":"e7f3d459f828f671","type":"debug","z":"3e6e1c87317d6268","name":"STATE","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":450,"y":520,"wires":[]}]
hufftheweevil commented 1 year ago

Fixed in v1.2.1 Thank you!