NodeRED instance terminated when mattermost-client sends "error" event which leads on error [ERR_UNHANDLED_ERROR]
Mattermoset-client emits in some cases the "error" event which leads on termination of whole NodeRED instance. One example is for example a wrong/unknown team name.
In this case following error is thrown:
2 Dec 10:19:10 - [error] Error [ERR_UNHANDLED_ERROR]: Unhandled error. ({ msg: 'failed to get channel list' })
at new NodeError (node:internal/errors:371:5)
at p.emit (node:events:515:17)
at p._onChannels (C:\Sources\de.captica.customer\gateway\node_modules\mattermost-client\dist\mattermost-client.js:1:3237)
at Request._callback (C:\Sources\de.captica.customer\gateway\node_modules\mattermost-client\dist\mattermost-client.js:1:12074)
at Request.self.callback (C:\Sources\de.captica.customer\gateway\node_modules\request\request.js:185:22)
at Request.emit (node:events:526:28)
at Request.<anonymous> (C:\Sources\de.captica.customer\gateway\node_modules\request\request.js:1154:10)
at Request.emit (node:events:526:28)
at IncomingMessage.<anonymous> (C:\Sources\de.captica.customer\gateway\node_modules\request\request.js:1076:12)
at Object.onceWrapper (node:events:645:28)
at IncomingMessage.emit (node:events:538:35)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
As solution I would add a listener in the config node and hold the error which can be provided on node status.
Edited by Tobias Lehmann
