thing-it-device-wtec
Advanced tools
Comparing version 0.0.3 to 0.0.4
@@ -253,3 +253,3 @@ "use strict"; | ||
"use strict"; | ||
//this.logDebug(response); | ||
this.logDebug(response); | ||
@@ -256,0 +256,0 @@ if (response.name) this.state.name = response.name; |
{ | ||
"name": "thing-it-device-wtec", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "[thing-it-node] Device Plugin for wtec devices.", | ||
@@ -5,0 +5,0 @@ "authors": "Klaus Berberich", |
@@ -262,12 +262,18 @@ module.exports = { | ||
response.on('data', function (chunk) { | ||
if (chunk) { | ||
if (chunkCount === 0) { | ||
deferred.resolve; | ||
} | ||
if (chunkCount === 0) { | ||
deferred.resolve; | ||
} | ||
chunkCount++; | ||
chunkCount++; | ||
if (callback) { | ||
var result = JSON.parse(chunk.toString()); | ||
callback(null, result); | ||
if (callback && chunk.length > 1) { | ||
var chunkString = chunk.toString(); | ||
try { | ||
var result = JSON.parse(chunkString); | ||
callback(null, result); | ||
} catch (e) { | ||
this.logDebug('Error parsing chunk of length ' + chunk.length + ' (' + chunkString + '): ', e); | ||
} | ||
} | ||
} | ||
@@ -274,0 +280,0 @@ }.bind(this)); |
64532
1468