# Extend the catch node to errors not triggered by message processing

**URL:** <https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336>\
**Category:** Feature Requests\
**Tags:** catch\
**Created:** [9 October 2025 15:24 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336 "2025-10-09T15:24:24Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [9 October 2025 15:24 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/1 "2025-10-09T15:24:24Z")

</div>

Hi all,

Would it be possible to extend the catch node to errors not triggered by message processing?

I recently had an Omron installation that was experiencing an error because the PLC was no longer reachable, and I was surprised that I didn't receive a notification.

After investigation, the cause was that the catch node is only triggered if the call to `node.error` contains a message.

cc @Steve-Mcl, `onClientError` with undefined sequence.

---

<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:** [9 October 2025 15:36 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/2 "2025-10-09T15:36:23Z")

</div>

So, as you have realised, the error is generated not in the `on` `input` handler but by an exteranl async event so there is no msg to include: [node-red-contrib-omron-fins/nodes/read.js at master · Steve-Mcl/node-red-contrib-omron-fins · GitHub](https://github.com/Steve-Mcl/node-red-contrib-omron-fins/blob/master/nodes/read.js#L71) (though I do try via tags)

It would be good if the catch node could be configured to catch those error without a message too but I have not looked in to what it would take nor considered the consequences (would likely need to be a new catch node option to stay backwards compatible)

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [10 October 2025 10:10 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/3 "2025-10-10T10:10:37Z")

</div>

If we add an option to allow _any error_ I don't think there will be any unintended consequences.

In the `done` section of the Messaging API, `node.error` is called with the message, so our only concern is the `node.error` call itself. Adding the new option allows to filter which nodes should be triggered.

Another question to discuss is regarding config nodes; do we also allow them? If so, how do we integrate them into the UI? With the 'global config' flow (for global scope)?

---

<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:** [10 October 2025 11:37 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/4 "2025-10-10T11:37:54Z")

</div>

For anyone else reading and need to know if an async disconnection or error has occurred in the Omron nodes, they DO update their own status. So while you cannot (currently) catch the async error, you can pick it up via a status node pointed at the Omron node(s).

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [25 October 2025 11:29 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/5 "2025-10-25T11:29:08Z")

</div>

Is anyone else interested?

@knolleary I'll be adding a concept soon.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [25 October 2025 12:55 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/6 "2025-10-25T12:55:42Z")

</div>

I’m sure some other core nodes send an error without a msg. They just create a dummy ( sensible default) msg and use that instead.

---

<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:** [25 October 2025 13:51 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/7 "2025-10-25T13:51:48Z")

</div>

> [@GogoVega](#):
>
> Is anyone else interested

Yes

> [@GogoVega](#):
>
> I'll be adding a concept soon

What's your thoughts?

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [25 October 2025 14:25 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/8 "2025-10-25T14:25:02Z")

</div>

Add an option in the configuration to allow "any error".  
Allow the UI to offer config nodes.

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [26 October 2025 10:26 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/9 "2025-10-26T10:26:22Z")

</div>

Editor:

- `all nodes`
  - keep the actual behavior

- `all nodes and config nodes`
  - this enables `anyError`

- `same group`
  - keep the actual behavior

- `selected nodes`
  - show a new checkbox to enable `anyError` (allow any error other than message processing)
  - the searchBox will contain two tabs (the current flow and the global flow)
  - config nodes will be included there but I don't yet know how to visually differentiate them
  - config nodes should be filtered based on whether `anyError` is enabled.
  - there's no point in trying to make `anyError` configurable for every node, as the message either exists or it doesn't.

Or a new checkbox to include config nodes. This allows to keep all three options (too ambiguous to change)

Runtime:

- `flow.handleError` will be called if the message is:
  - an `object`
  - `undefined`
  - `null` (optional - need to discuss)

- catch nodes will be triggered if:
  - `msg` exists (actual behavior)
  - `msg` does not exist and `anyError` is enabled

- propagate Error events from global config nodes to any nodes using this config node
  - will not be called if the scope contains the config node or if the option is `all nodes and config nodes`

I think I have detailed everything. Do not hesitate if you have any questions/remarks.

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [26 October 2025 16:13 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/10 "2025-10-26T16:13:43Z")

</div>

It works fine except for one unforeseen event.

@knolleary, why is `node.users` always `undefined` for config node?

> <https://github.com/node-red/node-red/blob/32831cb3b4b1f4a6b037dcfd9b7cd14416a6ccbd/packages/node_modules/%40node-red/runtime/lib/flows/Flow.js#L615-L623>

---

<div class="post-metadata">

**Author:** ![GogoVega](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/gogovega/32/71313_2.png) [@GogoVega](https://discourse.nodered.org/u/GogoVega)\
**Post date:** [26 October 2025 18:58 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/11 "2025-10-26T18:58:24Z")

</div>

Draft PR submitted:

> <https://github.com/node-red/node-red/pull/5329>
>
> \## Types of changes
> 
> \- \[\] Bugfix (non-breaking change which fixes an issue)
> …- \[x\] New feature (non-breaking change which adds functionality)
> 
> \## Proposed changes
> 
> Allow \`catch\` node to catch any error other than message processing and to catch errors from config nodes.
> 
> \### Concept
> 
> Each \`catch\` node can select one or more config nodes from the same scope or from the global scope.
> 
> \#### Editor:
> 
> \- \`all\`
> - show a new checkbox to enable \`anyError\` (allow any error other than message processing) \[^1\]
> - show a new checkbox to enable \`includeConfig\` (allow to catch errors from config nodes from the same scope and from the global scope)
> \- \`group\`
> - keep the actual behavior
> \- \`target\`
> - show a new checkbox to enable \`anyError\` (allow any error other than message processing) \[^1\]
> - show a new checkbox to enable \`includeConfig\` (allow to catch errors from config nodes from the same scope or from the global scope)
> - the \`treeList\` will contain two tabs (the current flow and the global flow)
> - config nodes will be included there with an \`fa-cog\` icon
> 
> \#### Runtime:
> 
> \- \`flow.handleError\` will be called if the message is:
> - an \`object\`
> - \`undefined\`
> \- catch nodes will be triggered if:
> - \`msg\` exists (actual behavior)
> - \`msg\` does not exist and \`anyError\` is enabled
> \- propagate Error events from global config nodes to any nodes using this config node
> - will not be called if the scope contains the config node or if the option is \`all nodes and config nodes\`
> 
> \### Limitations
> 
> \- the \*select nodes\* functionality does not exist for config nodes
> 
> \### Related Issue(s)
> 
> \- https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336
> 
> \### Todo list
> 
> \- \[\] Finds out how to trigger \`catch\` nodes when errors comes from any global config node (\`Flow\` instance does not have access to \`activeFlows\`
> \- \[\] Update node docs
> \- \[\] Adapt/update core nodes
> 
> \## Checklist
> 
> \- \[x\] I have read the \[contribution guidelines\](https://github.com/node-red/node-red/blob/master/CONTRIBUTING.md)
> \- \[x\] For non-bugfix PRs, I have discussed this change on the forum/slack team.
> \- \[x\] I have run \`npm run test\` to verify the unit tests pass
> \- \[\] I have added suitable unit tests to cover the new/changed functionality
> 
> \[^1\]: Of course if a config node is selected but the \`anyError\` option is disabled, the error will not be caught

---

<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:** [25 December 2025 18:58 UTC](https://discourse.nodered.org/t/extend-the-catch-node-to-errors-not-triggered-by-message-processing/99336/12 "2025-12-25T18:58:48Z")

</div>

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