Node-RED: How to Catch and Log Errors from Node-RED Nodes

This documentation is part of the Getting Started guide. You can view the complete guide here: How to Get Started with Node-RED.

👋 Welcome to the Stackhero documentation!

Stackhero offers a ready-to-use Node-RED cloud solution that provides a host of benefits, including:

  • MQTT server included (Mosquitto).
  • Full access to Node-RED admin UI.
  • Node-RED Dashboard included.
  • Unlimited and dedicated SMTP email server included.
  • Effortless updates with just a click.
  • Customizable domain name secured with HTTPS (for example, https://node-red.your-company.com).
  • Optimal performance and robust security powered by a private and dedicated VM.

Save time and simplify your life: it only takes 5 minutes to try Stackhero's Node-RED cloud hosting solution!

At times, nodes may generate errors. A practical solution is to set up a "catch all debug" flow to monitor these errors.

Example of a Node-RED error catch flowExample of a Node-RED error catch flow

To set this up, add a catch node and connect it to a debug node. Configure the debug node to output the complete msg object. This setup logs each error generated in the flow to the Node-RED debug window.

Example of a Node-RED node error caughtExample of a Node-RED node error caught

A catch node is only triggered by errors from nodes within the same flow. If you use multiple flows (or tabs), you will need to add the catch and debug nodes to each flow.