Answers for ".catch chain"

0

.catch chain

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');
});
Posted by: Guest on August-22-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language