mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Add extra try/catch to Blink1 to catch unplug error.
This commit is contained in:
parent
3d78a93958
commit
448f83e337
@ -28,6 +28,7 @@ function Blink1Node(n) {
|
|||||||
var p2 = /[0-9]+,[0-9]+,[0-9]+/
|
var p2 = /[0-9]+,[0-9]+,[0-9]+/
|
||||||
this.on("input", function(msg) {
|
this.on("input", function(msg) {
|
||||||
if (blink1) {
|
if (blink1) {
|
||||||
|
try {
|
||||||
if (p1.test(msg.payload)) {
|
if (p1.test(msg.payload)) {
|
||||||
// if it is a hex colour string
|
// if it is a hex colour string
|
||||||
var r = parseInt(msg.payload.slice(1,3),16);
|
var r = parseInt(msg.payload.slice(1,3),16);
|
||||||
@ -59,9 +60,10 @@ function Blink1Node(n) {
|
|||||||
node.warn("Blink1 : invalid msg : "+msg.payload);
|
node.warn("Blink1 : invalid msg : "+msg.payload);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e) { node.warn("Blink1 : error"); }
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
node.warn("No Blink1 found");
|
node.warn("Blink1 : not found");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
//This ought to work but seems to cause more hangs on closing than not...
|
//This ought to work but seems to cause more hangs on closing than not...
|
||||||
|
Loading…
Reference in New Issue
Block a user