update on elasticsearch.js, handling on exception response [jquery]
This commit is contained in:
9
src/lib/connectors/jquery.js
vendored
9
src/lib/connectors/jquery.js
vendored
@ -33,7 +33,14 @@ JqueryConnector.prototype.request = function (params, cb) {
|
||||
});
|
||||
})
|
||||
.fail(function (a, b, err) {
|
||||
cb(new ConnectionFault(err && err.message));
|
||||
// if response is available, execute cb. Else throw ConnectionFault
|
||||
if (a && a.responseText) {
|
||||
cb(null, a.responseText, jqXHR.statusCode(), {
|
||||
'content-type': jqXHR.getResponseHeader('content-type')
|
||||
});
|
||||
} else {
|
||||
cb(new ConnectionFault(err && err.message));
|
||||
}
|
||||
});
|
||||
|
||||
return function () {
|
||||
|
||||
Reference in New Issue
Block a user