fix Zabbix API error message

This commit is contained in:
Alexander Zobnin
2017-10-22 11:37:17 +03:00
parent 538589b99b
commit df64c190e2
8 changed files with 24 additions and 31 deletions

View File

@@ -83,8 +83,6 @@ var ZabbixAPICoreService = function () {
// Success
return response.data.result;
}).catch(function () {
return Promise.reject(new ZabbixAPIError({ data: "Connection Error" }));
});
}
@@ -125,16 +123,16 @@ var ZabbixAPIError = exports.ZabbixAPIError = function () {
function ZabbixAPIError(error) {
_classCallCheck(this, ZabbixAPIError);
this.code = error.code;
this.name = error.data;
this.message = error.data;
this.data = error.data;
this.code = error.code || null;
this.name = error.message || "";
this.data = error.data || "";
this.message = "Zabbix API Error: " + this.name + " " + this.data;
}
_createClass(ZabbixAPIError, [{
key: 'toString',
value: function toString() {
return this.name + ": " + this.message;
return this.name + " " + this.data;
}
}]);