From 7b15b79a61144caef5cde4b9a4837e592ca043e3 Mon Sep 17 00:00:00 2001 From: Harrison Goscenski Date: Tue, 13 Feb 2024 09:35:32 -0600 Subject: [PATCH 1/4] Fixes issue #9 --- package.json | 2 +- src/index.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 965bbca..5e58556 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wyze-api", - "version": "1.1.3", + "version": "1.1.4", "description": "An unoficial API wrapper for Wyze products.", "homepage": "https://github.com/jfarmer08/wyze-api", "main": "./src/index.js", diff --git a/src/index.js b/src/index.js index b18d272..b7cc9d7 100644 --- a/src/index.js +++ b/src/index.js @@ -8,6 +8,7 @@ const crypto = require("./crypto"); const constants = require("./constants"); const util = require("./util"); const { time } = require("console"); +const { rmSync } = require("fs"); module.exports = class WyzeAPI { constructor(options, log) { @@ -144,7 +145,11 @@ module.exports = class WyzeAPI { throw e; } - this.log.debug(result.data.msg); + // this.log.debug(result.data.msg); + if (result.data.code != 1) { + this.log.error(`Error during request, '${result.data.msg}'`) + throw new Error("Error during request"); + } return result; } From e2a8a76f7a16c50433e77ed52c5af5e446cad9ab Mon Sep 17 00:00:00 2001 From: Harrison Goscenski Date: Tue, 13 Feb 2024 09:36:29 -0600 Subject: [PATCH 2/4] Fixing error message and lowering error to debug as it may be recoverable --- src/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index b7cc9d7..f5d12df 100644 --- a/src/index.js +++ b/src/index.js @@ -147,8 +147,8 @@ module.exports = class WyzeAPI { } // this.log.debug(result.data.msg); if (result.data.code != 1) { - this.log.error(`Error during request, '${result.data.msg}'`) - throw new Error("Error during request"); + this.log.debug(`Potentially recoverable error during request, '${result.data.msg}'`) + throw new Error("Potentially recoverable error during request"); } return result; } From 2243afa539bcbd036ea3170ee68353717c3c1ee2 Mon Sep 17 00:00:00 2001 From: Harrison Goscenski Date: Tue, 13 Feb 2024 09:37:23 -0600 Subject: [PATCH 3/4] Removing accidental library addition --- src/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/src/index.js b/src/index.js index f5d12df..42e0154 100644 --- a/src/index.js +++ b/src/index.js @@ -8,7 +8,6 @@ const crypto = require("./crypto"); const constants = require("./constants"); const util = require("./util"); const { time } = require("console"); -const { rmSync } = require("fs"); module.exports = class WyzeAPI { constructor(options, log) { From 64658d1304562e278e4a611a52749f5fc29a40f7 Mon Sep 17 00:00:00 2001 From: Harrison Goscenski Date: Tue, 13 Feb 2024 09:37:55 -0600 Subject: [PATCH 4/4] Removing unecessary comment --- src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 42e0154..722b0f1 100644 --- a/src/index.js +++ b/src/index.js @@ -144,7 +144,7 @@ module.exports = class WyzeAPI { throw e; } - // this.log.debug(result.data.msg); + if (result.data.code != 1) { this.log.debug(`Potentially recoverable error during request, '${result.data.msg}'`) throw new Error("Potentially recoverable error during request");