Handling errors
Dernière mise à jour
Dernière mise à jour
While it is easy to create flows that do the right thing when everything works, it is also important to think about what could go wrong.
For example, if the flow interacts with an external database or API, what happens if it stops responding to requests?
Error handling in any application is essential to ensure these sorts of events are handled properly. What it means to handle the error will depend on the requirements of the application. You may want to try an action that failed, or trigger a separate alert, or maybe the error is an entirely expected event that is just another part of the application logic.
Iconnek provides two ways for a node to report an error. It can either just write a message to the log or it can notify the runtime of the error and cause a flow to be triggered.
If the error is only written to the log, you will see the message in the debug sidebar and log output, but you will not be able to create a flow to handle it. These are uncatchable errors.
If it does notify the runtime properly, then it is a catchable error that can be used to trigger an error-handling flow.
When a node logs an error, it will appear in the debug sidebar.
If a node notifies the runtime of an error then the Catch node can be used to create a flow to handle it.
Catch node
The message sent by the Catch will be the message provided by the node reporting the error. This message will have an msg.payload
property set that provides information about the error.