[#154, backend/elasticsearch][s]: backend errors now reported up the stack (implement deferred reject when call to backend fails).

This commit is contained in:
Rufus Pollock
2012-06-15 22:32:18 +01:00
parent 87df9ea080
commit 617d3440f0
2 changed files with 9 additions and 1 deletions

View File

@@ -213,6 +213,12 @@ this.recline.Backend.ElasticSearch = this.recline.Backend.ElasticSearch || {};
results.hits.facets = results.facets; results.hits.facets = results.facets;
} }
dfd.resolve(results.hits); dfd.resolve(results.hits);
}).fail(function(errorObj) {
var out = {
title: 'Failed: ' + errorObj.status + ' code',
message: errorObj.responseText
};
dfd.reject(out);
}); });
return dfd.promise(); return dfd.promise();
}; };

View File

@@ -128,6 +128,7 @@ test("query", function() {
return { return {
done: function(callback) { done: function(callback) {
callback(sample_data); callback(sample_data);
return this;
}, },
fail: function() { fail: function() {
} }
@@ -224,10 +225,11 @@ test("query", function() {
return { return {
done: function(callback) { done: function(callback) {
callback(sample_data); callback(sample_data);
return this;
}, },
fail: function() { fail: function() {
} }
} };
} }
}); });