No error logging with catch node

I really like to use te catch node, to catch errors and program logic after that.For example, I use this to response http 500, with error message to the client side. I mostly use node-red as backend (API).

All loging from level 'info' are logged into Loki and are presented in Grafana. For me this is a perfect solution to keep insights in all events and errors in node-red. I set up this custom logger in de settings file.

One negative side effect of using the catch node is that node-red won't log the error anymore. So when something went wrong, I won't see any logging of this event. In my opinion this isn't correct. There is an error raised, but catched.

Two questions:

  • Is there another way to do the logging of catched errors? (no I don't want to raise another 'not catch' error, after the catch node :slight_smile: )
  • Do you agree with me? FR?

Do you mean the debug sidebar no longer sees the error? or do you mean the node-red console / log doesnt see the error?

Is it not sufficient to output the error to a debug node - with (if required) " to console" checked?

Do you mean the debug sidebar no longer sees the error? or do you mean the node-red console / log doesnt see the error?

system console (actualy both, but I don't care about node-red console)

Is it not sufficient to output the error to a debug node - with (if required) " to console" checked?

Yeah that could be a solution. But it has two disadvantages:

  • the logging format is different. So it would be difficult to collect en present the logs
  • I have to add after al catch node a debug node

The idea of using a catch node - is to catch the error so it is no longer visible. If you want to see the error then it is clear to use a debug node and investigate the msg.error object. This is working as it should. I don't want to see any errors when i use a catch node. However the catch node can not catch all errors.

I don't agree. As I see it, the catch-node is a low-code variant of try and catch.
If you write a peace of code with try and catch for unexpected situations, you still want logging.
You take care of this in catch part of your code. In other words, I think to the catch node should have a option to log error, and continue...

In combination with the debug node - you have all options to write a flow to react on the error. I prefer to use Node Red using core Nodes instead of hiding everything in code.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.