📜  .catch 链 - Javascript 代码示例

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

代码示例1
new Promise((resolve, reject) => {
    console.log('Initial');

    resolve();
})
.then(() => {
    throw new Error('Something failed');

    console.log('Do this');
})
.catch(() => {
    console.error('Do that');
})
.then(() => {
    console.log('Do this, no matter what happened before');
});