diff --git a/lib/salix.js b/lib/salix.js index 9f2e40f..db28c25 100644 --- a/lib/salix.js +++ b/lib/salix.js @@ -142,11 +142,12 @@ module.exports = class Salix { `${this.conf.salix.url}/${path}`, fetchConfig ); - if (salixCall.status !== 200) { - throw new Error(response); - } const responseText = await salixCall.text(); const response = JSON.parse(responseText); + + if (salixCall.status !== 200) { + throw new Error(response.error.message); + } const newVersion = salixCall.headers.get(SALIX_VERSION_HEADER); if (!this.salixVersion) { @@ -172,14 +173,13 @@ module.exports = class Salix { async getSalixVersion() { this.log("CHECK VERSION"); - await this.fetch(this.conf.salix.api.status); + await this.fetch(this.conf.salix.api.modelinfo); - this.log("VERSION CHECKED"); + this.log("VERSION CHECKED -- "+ this.salixVersion); } async salixLogInfo() { this.log("REQUEST LOGINFO"); - await this.getToken(); let salixLogConfig = await this.fetch(this.conf.salix.api.logInfo); this._logInfo = salixLogConfig;