Node-red catch not work with ewelink node-red control-device

Why node-red catch not catch error from node-red ewelink control-device. Node-red complete not work to.
Why?
msg.payload.error is not error for catch?
How can I do to catch this error?

What is your use case?
Can I have some screenshot or configuration of your node?

install a test node “control-device” and catch its errors using the standard node “catch”. doesn’t catch.
error 110006 is not caught.

110006 is an error code returned by api, not an internal error.
It should not be thrown or catched.

1 Like

Can you do in control-device chechbox “raise api error” to caught api error by catch?

Put a debug node after the device to see the string of characters created by an error. The error node is just to catch errors in Node Red itself. Then put a switch node after looking for that specific error and send yourself a notification using WhatsApp/telegram/pushover etc. I do something similar to catch all errors and try again with devices that are sometimes not available on wifi. You can add delays and counters to try again a certain number of times every 30s or so. It’s so simple I suspect the functionality could easily be added into the node itself.

Exactly as you described is what I do.
But my error is part of the normal operation of the system.
While running programs, another chain or someone else can turn off the power and all you need to do is catch the error and turn on the power for a while and restart the setup.
But there are a lot of places where the error occurs and there are also a lot of connections with a restart as a result.
The diagram looks ugly and unreadable.
But if each control-device had a “raise API error” checkbox and possibly an error filter, then the scheme would become much simpler.

This is what I keep meaning to do to help with the mess:
https://nodered.org/docs/user-guide/editor/workspace/subflows

In my case this is not really necessary and does not greatly simplify the algorithm.
Catch would be the most convenient and clearest in meaning.

Is it possible to do what I suggest?

Not easily no. You could find a badly coded node and then having it only fire if there is an eWelibk style error or look up how errors are fired within Node Red and then manually use the method with a function node. I would just put a repeatable eWeLink-error catching series of nodes in a sub-flow called “catch eWeLink error” and then use used the new Node you created.

Well, I don’t have poorly coded nodes, the power can simply be turned off and must be turned on if an error occurs.
It’s not possible to put it into the subflow, there are too many branches.
But the opportunity to not draw a bunch of branches, checks and connections would be great.
Can I make a subflow like this so that the control device can do a raise error"?

Pretty sure creating a badly coded node would be easy to do. JavaScript isn’t a language I know so I’ve probably done it quite a lot.

Suspect a function node saying:

{node.error(“eWeLink Error”, msg)};
rtn msg

or something like that would create an error that would be seen by the normal catch node. I’m probably using the curly brackets wrong.

My experience of sub-flows is that they are just a way to make things look nicer. Just bare in mind they only have 1 entrance, but can have multiple our. Limits what you can do with them.

It turns out I need to pass different control-device calls to the subflow.
And how to do it?

I don’t really know what you mean. If you mean you only need to pass some messages to your ai flow then a Switch Node. For example you could pass only errors to the subflow. If you actually want to change the contents of messages; eg copy from one bit of a message to another but then it is a Change Node.