More informative error when master is unavailable

This commit is contained in:
Danielv123 committed 2017-12-09 14:49:11 +01:00
1 parent 7682a51437
commit 36ccf22e02
1 file changed
+3 -1
+3 -1
View File
@@ -730,7 +730,9 @@ function instanceManagement() {
// get inventory from Master and RCON it to our slave
setInterval(function () {
needle.get(config.masterIP + ":" + config.masterPort + '/api/inventory', function (err, response, body) {
if (response && response.body) {
if(err){
console.log("Unable to get JSON master/api/inventory, master might be unaccessible");
} else if (response && response.body) {
// Take the inventory we (hopefully) got and turn it into the format LUA accepts
try {
var inventory = JSON.parse(response.body);