# No error logging with catch node

**URL:** <https://discourse.nodered.org/t/no-error-logging-with-catch-node/60933>\
**Category:** General\
**Created:** [7 April 2022 10:22 UTC](https://discourse.nodered.org/t/no-error-logging-with-catch-node/60933 "2022-04-07T10:22:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![AMWN](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/amwn/32/41809_2.png) [@AMWN](https://discourse.nodered.org/u/AMWN)\
**Post date:** [7 April 2022 10:22 UTC](https://discourse.nodered.org/t/no-error-logging-with-catch-node/60933/1 "2022-04-07T10:22:10Z")

</div>

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 🙂 )
- Do you agree with me? FR?

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [7 April 2022 11:06 UTC](https://discourse.nodered.org/t/no-error-logging-with-catch-node/60933/2 "2022-04-07T11:06:54Z")

</div>

> [@AMWN](#):
>
> One negative side effect of using the catch node is that node-red won't log the error anymore.

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

> [@AMWN](#):
>
> 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

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

---

<div class="post-metadata">

**Author:** ![AMWN](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/amwn/32/41809_2.png) [@AMWN](https://discourse.nodered.org/u/AMWN)\
**Post date:** [7 April 2022 11:22 UTC](https://discourse.nodered.org/t/no-error-logging-with-catch-node/60933/3 "2022-04-07T11:22:02Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [7 April 2022 11:35 UTC](https://discourse.nodered.org/t/no-error-logging-with-catch-node/60933/4 "2022-04-07T11:35:07Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![AMWN](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/amwn/32/41809_2.png) [@AMWN](https://discourse.nodered.org/u/AMWN)\
**Post date:** [7 April 2022 11:50 UTC](https://discourse.nodered.org/t/no-error-logging-with-catch-node/60933/5 "2022-04-07T11:50:29Z")

</div>

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...

---

<div class="post-metadata">

**Author:** ![mickym2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mickym2/32/36128_2.png) [@mickym2](https://discourse.nodered.org/u/mickym2)\
**Post date:** [7 April 2022 11:52 UTC](https://discourse.nodered.org/t/no-error-logging-with-catch-node/60933/6 "2022-04-07T11:52:55Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [6 June 2022 11:53 UTC](https://discourse.nodered.org/t/no-error-logging-with-catch-node/60933/7 "2022-06-06T11:53:44Z")

</div>

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