So if I run this simple call in node.js v0.6.7 on OS X 10.6.8 with a bogus path, I get an error, as expected.
var fs = require("fs");
fs.stat("/tmp/foo", function(error, stat) {
return console.log(error);
});
It prints this output:
{ [Error: ENOENT, no such file or directory '/tmp/foo'] errno: 34, code: 'ENOENT', path: '/tmp/foo' }
My question is, according to /usr/include/sys/errno.h on my system, ENOENT should have code 2, so why is this error saying errno 34 (ERANGE in errno.h), but pairing it with the error message from ENOENT?
node.js translates system
errnos to internal “errnos” (seedeps/uv/include/uv.handuv_translate_sys_errorindeps/uv/src/unix/error.cordeps/uv/src/win/error.cfor a mapping) as to achieve a common representation for error-conditions under Windows and Unix.34 is the node.js-errno for
ENOENT, so everything is alright.