Is there a way to ignore asynchronous errors while calling a function?
Synchronous
function synchronous() {
console.log('Nice feature');
throw new Error('Async Error');
}
try {
synchronous();
console.log('Succeeded');
} catch (e) {
console.log('Caught');
}
Console Output:
Nice feature
Caught
Asynchronous
async function asynchronous() {
console.log('Nice feature');
throw new Error('Async Error');
}
try {
asynchronous();
console.log('Succeeded');
} catch (e) {
console.log('Caught');
}
Console Output:
Nice feature
Uncaught (in promise) Error: Async Error at asyncFunc