Skip to main content
Journey Uncommon Logo
JourneyUncommon
easyNodeJSfs file reading writingSingle-choice MCQ

Using the callback-based `fs` API, what is wrong with this attempt to handle errors?

const fs = require('fs'); try { fs.readFile('missing.txt', 'utf8', (err, data) => { console.log(data.toUpperCase()); }); } catch (e) { console.log('handled:', e.message); }