Merge pull request #6154 from spalger/fix/failTestOnBadBulk

[scenarioManager] when bulk fails, report errors
This commit is contained in:
Spencer 2016-02-08 15:36:54 -07:00
commit 233869f9c3

View file

@ -42,6 +42,18 @@ ScenarioManager.prototype.load = function (id) {
body: body
});
})
.then(function (response) {
if (response.errors) {
throw new Error(
'bulk failed\n' +
response.items
.map(i => i[Object.keys(i)[0]].error)
.filter(Boolean)
.map(err => ' ' + JSON.stringify(err))
.join('\n')
);
}
})
.catch(function (err) {
if (bulk.haltOnFailure === false) return;
throw err;