📜  承诺捕获 javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:39.530000             🧑  作者: Mango

代码示例2
// errors that occur in asynchronous code inside promises cannot be caught with regular try/catch
// you need to pass the error handler into `.catch()`

fetchUserData(userId).then(console.log).catch(handleError);