First time trying to use the Q promises library and I can't get my error callback to work:
var fs = require('fs');
var Q = require('q');
var prom = Q.nfcall(fs.writeFile('daa/write.txt', 'your mom', 'utf-8'));
prom.then(function(err){
console.log("error on writing file: ", err);
});
I am deliberately giving a wrong destination to the write function to trigger an error. But on the command line I get this error:
fs: missing callback Error: ENOENT, open 'daa/write.txt'"
Why is my error callback not getting called? Why is my error callback missing?