主要区别就是,如果在 then 的第一个函数里抛出了异常,后面的 catch 能捕获到,而第二个函数捕获不到

p.then(function () {
    throw new Error()
  }, function () {
    // won't capture this error
  })
  .catch(function () {
    // will capture the error
  })

 

相关文章:

  • 2021-11-05
  • 2022-12-23
  • 2021-11-29
  • 2022-12-23
  • 2022-02-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2021-12-29
  • 2022-12-23
相关资源
相似解决方案