Permalink
Browse files

dns: make error message match errno

  • Loading branch information...
danmilon authored and bnoordhuis committed Jan 18, 2013
1 parent 31583be commit 7295bb9435c10fe569d36e64d50769fed4b5d7e3
Showing with 3 additions and 1 deletion.
  1. +2 −1 lib/dns.js
  2. +1 −0 test/internet/test-dns.js
View
@@ -28,13 +28,14 @@ function errnoException(errorno, syscall) {
// TODO make this more compatible with ErrnoException from src/node.cc
// Once all of Node is using this function the ErrnoException from
// src/node.cc should be removed.
var e = new Error(syscall + ' ' + errorno);
// For backwards compatibility. libuv returns ENOENT on NXDOMAIN.
if (errorno == 'ENOENT') {
errorno = 'ENOTFOUND';
}
var e = new Error(syscall + ' ' + errorno);
e.errno = e.code = errorno;
e.syscall = syscall;
return e;
@@ -308,6 +308,7 @@ TEST(function test_lookup_failure(done) {
assert.ok(err instanceof Error);
assert.strictEqual(err.errno, dns.NOTFOUND);
assert.strictEqual(err.errno, 'ENOTFOUND');
assert.ok(!/ENOENT/.test(err.message));
done();
});

0 comments on commit 7295bb9

Please sign in to comment.