在我的Sails.js应用程序初始化期间,我需要执行多个任务,一个依赖于另一个。如果这些任务中的任何一个返回错误,则整个链应该失败并取消sails lift
。
伪代码:
configureApis()
.then(getServiceStatus)
.then(setRegionJobs)
.then(cb)
.catch(cb)
问题是,这些函数中的每一个都返回Promises(cb
除外,它是回调函数in this question。
我怎样才能做到这一点? async.waterfall
会在这里有用吗?