主要区别就是,如果在 then 的第一个函数里抛出了异常,后面的 catch 能捕获到,而第二个函数捕获不到
p.then(function () { throw new Error() }, function () { // won't capture this error }) .catch(function () { // will capture the error })
主要区别就是,如果在 then 的第一个函数里抛出了异常,后面的 catch 能捕获到,而第二个函数捕获不到
p.then(function () { throw new Error() }, function () { // won't capture this error }) .catch(function () { // will capture the error })
本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。