From 913580aec2e3a2a5368516af52efe8a12ec81dec Mon Sep 17 00:00:00 2001 From: jangxx Date: Tue, 29 Jan 2019 22:10:49 +0100 Subject: [PATCH] added constructor parameter check --- HCMagicHome.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/HCMagicHome.js b/HCMagicHome.js index 819e4d6..955a0c4 100644 --- a/HCMagicHome.js +++ b/HCMagicHome.js @@ -25,6 +25,10 @@ class HCMagicHome extends HCColorLamp { constructor(config) { super(config); + if (!("address" in this._configuration)) { + throw new Error(`Required configuration field "address" is missing"`); + } + let type = "type1"; if (this._configuration.type != undefined) { type = this._configuration.type;