This commit adds a code field to the error returned by
nullCheck().
Fixes: https://github.com/iojs/io.js/issues/517
PR-URL: https://github.com/iojs/io.js/pull/519
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
function nullCheck(path, callback) {
if (('' + path).indexOf('\u0000') !== -1) {
var er = new Error('Path must be a string without null bytes.');
+ er.code = 'ENOENT';
if (!callback)
throw er;
process.nextTick(function() {
var argsSync = Array.prototype.slice.call(arguments, 2);
var argsAsync = argsSync.concat(function(er) {
assert(er && er.message.match(expected));
+ assert.equal(er.code, 'ENOENT');
});
if (sync)