如果我在第一个request.post中遇到错误,我希望代码继续下一个,下面的代码只是停止,任何提示?
var Promise = require("bluebird");
var request = Promise.promisifyAll(require('request'));
var URLS = ["http://sample.com/j1", "http://sample.com/j2"]
Promise.map(URLS, function (item) {
return request.postAsync({url: item}).spread(function (response, body) {
var items = JSON.parse(body)
return items
})
}).then(function (r) {
console.log(r.length)
}).catch(SyntaxError, function (e) {
console.log('err', e)
});