I have added a catch block to the flow for http request. I observed that even though the catch block is triggered the flow (within which I have http-request) triggering catch block still continues. This results in the response coming multiple times and node-red throwing an error. My concern is similar to the one asked here (
Break flow after http request error) but the replies on it are a couple of years ago. Is there a way to handle such situations better now?
I don't think this has changed unfortunately.
I would like to see consistent behaviour for situations like this across all core nodes but as Nick states it would be a behavioural change.
Perhaps one day, in a major version bump we will do a sweep on all the core nodes behaviour but until then, you will need to use a switch after the http request to drop responses. Note: I think if an error is thrown, the msg
will contain a property named error
so perhaps that is what you test to ensure only one response is made.
Actually for errors such as NOT_FOUND or Server Not Responding I am able to get the flow only to catch by ticking Only send 2xx responses to catch block, is it the right way?
I've not used that feature (it was only recently added) so I can't comment on it's behaviour.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.