Node.js - Error Handling Patterns
Given this code, what will be the output and why?
async function getData() {
return Promise.reject('Failed to load');
}
getData()
.then(data => console.log('Data:', data))
.catch(err => {
console.log('Error caught:', err);
return 'Default data';
})
.then(result => console.log('Result:', result));