Using Promise.resolve($.ajax(options))
as mentioned here http://bluebirdjs.com/docs/api/promise.resolve.html is not working.
var $ = require('jquery');
var Promise = require('bluebird');
function makeRequest(options) {
return Promise.resolve($.ajax(options))
.then(function(data) { return data; },
function (error) { return error; });
}
When I call and url that returns an error (403 in this situation), and I add one more '.then', it always calls the fulfilled handler.
makeRequest(options).then(iAmBeingCalledWhenTheRequestFails, iAmNotBeingCalled);