From 6359e8a1a16cdb5c2c8692b776b06747bfe8f5a5 Mon Sep 17 00:00:00 2001 From: Unitech Date: Tue, 21 Aug 2018 17:14:15 +0200 Subject: [PATCH] fix: when wrong secret/public (statusCode>200) return proper msg to cli --- src/InteractorDaemon.js | 11 ++++++----- src/Utility.js | 1 - 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/InteractorDaemon.js b/src/InteractorDaemon.js index b5d3501..0190a46 100644 --- a/src/InteractorDaemon.js +++ b/src/InteractorDaemon.js @@ -257,11 +257,9 @@ const InteractorDaemon = module.exports = class InteractorDaemon { return cb(err) } + this.km_data = data + // Verify data integrity - if (!data.endpoints || data.active == false) { - console.trace(data) - return cb(new Error('Endpoints field not present or not active')) - } if (data.disabled === true || data.pending === true) { log('Interactor is disabled by admins') @@ -272,7 +270,10 @@ const InteractorDaemon = module.exports = class InteractorDaemon { return cb(null, data) } - this.km_data = data + if (!data.endpoints || data.active == false) { + console.trace(data) + return cb(new Error('Endpoints field not present or not active')) + } this.DAEMON_ACTIVE = true this.transport.connect(data.endpoints, cb) diff --git a/src/Utility.js b/src/Utility.js index 0936e10..ea95c89 100644 --- a/src/Utility.js +++ b/src/Utility.js @@ -350,7 +350,6 @@ class HTTPClient { } const req = http.request(options, (res) => { - if (res.statusCode > 200) return cb(new Error(`Non 200 status code received: ${res.statusCode}`)) let body = '' res.setEncoding('utf8')