Catch and ignore index_not_found_exception when deleting kibana index if not found.

This commit is contained in:
LeeDr 2015-11-12 12:05:22 -06:00
parent fd225796f7
commit e4e1e66b52

View file

@ -62,6 +62,13 @@ ScenarioManager.prototype.unload = function (id) {
return this.client.indices.delete({
index: indices
})
.catch(function (reason) {
// if the index never existed yet, or was already deleted it's OK
if (reason.message.indexOf('index_not_found_exception') < 0) {
console.log('reason.message: ' + reason.message);
throw reason;
}
});
};
@ -110,11 +117,11 @@ ScenarioManager.prototype.loadIfEmpty = function (id) {
if (response.count === 0) {
return self.load(id);
}
})
});
}))
.catch(function (reason) {
return self.load(id);
});
};
module.exports = ScenarioManager;
module.exports = ScenarioManager;