I'm not able to catch ENOENT of fs.createReadStream(). Is this an asynchronous function , which throws exception in a different closure-chain ?
$ node -v
v0.10.9
$ cat a.js
fs = require('fs')
try {
x = fs.createReadStream('foo');
} catch (e) {
console.log("Caught" );
}
$ node a.js
events.js:72
throw er; // Unhandled 'error' event
^
Error: ENOENT, open 'foo'
I am expecting 'Caught' to be printed rather than error stack !