From 448f83e337dd5d3c119aad81bd026009b85efa2c Mon Sep 17 00:00:00 2001 From: Dave C-J Date: Sun, 23 Feb 2014 18:59:56 +0000 Subject: [PATCH] Add extra try/catch to Blink1 to catch unplug error. --- hardware/blink/77-blink1.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hardware/blink/77-blink1.js b/hardware/blink/77-blink1.js index 2a7075f3..0dd3ca73 100644 --- a/hardware/blink/77-blink1.js +++ b/hardware/blink/77-blink1.js @@ -28,6 +28,7 @@ function Blink1Node(n) { var p2 = /[0-9]+,[0-9]+,[0-9]+/ this.on("input", function(msg) { if (blink1) { + try { if (p1.test(msg.payload)) { // if it is a hex colour string var r = parseInt(msg.payload.slice(1,3),16); @@ -59,9 +60,10 @@ function Blink1Node(n) { node.warn("Blink1 : invalid msg : "+msg.payload); } } + } catch (e) { node.warn("Blink1 : error"); } } 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...