From e042a50058a729eea8f4b19a669d7b6405d19b86 Mon Sep 17 00:00:00 2001 From: Your Name Date: Wed, 5 Mar 2014 02:51:38 +0000 Subject: [PATCH] Log and ignore errors thrown by the GPIO plugin which makes the app crashes. From time to time, it throws [Error: connection closed] --- plugins/gpio/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/plugins/gpio/index.js b/plugins/gpio/index.js index db1a257..a9aac8b 100644 --- a/plugins/gpio/index.js +++ b/plugins/gpio/index.js @@ -76,6 +76,10 @@ define([ 'pi-gpio' ], function(gpio) { collection.find({ direction: 'input' }).toArray(function(err, result) { + if (err) { + console.log(err); + return; + } result.forEach(function(item) { gpio.setDirection(parseInt(item.pin), "input", function(err) { gpio.read(parseInt(item.pin), function(err, value) {