Node.js - Error Handling Patterns
What will be logged to the console when running this code?
async function fetchData() {
try {
const data = await Promise.reject('Network error');
console.log('Data:', data);
} catch (err) {
console.log('Caught:', err);
}
}
fetchData();