📜  promise catch - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:01:05.502000             🧑  作者: 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);