Catch errors from RED.comms.subscribe callback

fixes #5262
pull/5263/head
Ben Hardill 2025-09-05 14:25:37 +01:00
parent 9ad329e5a1
commit d35b31cbef
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7
1 changed files with 7 additions and 1 deletions

View File

@ -116,7 +116,13 @@ RED.comms = (function() {
var subscribers = subscriptions[t];
if (subscribers) {
for (var i=0;i<subscribers.length;i++) {
subscribers[i](msg.topic,msg.data);
try {
subscribers[i](msg.topic,msg.data);
} catch (error) {
// need to decide what to do with this uncaught error
console.warn('Uncaught error from RED.comms.subscribe: ' + err.toString())
console.warn(err)
}
}
}
}