Skip to content

Commit 7295bb9

Browse files
danmilonbnoordhuis
authored andcommitted
dns: make error message match errno
1 parent 31583be commit 7295bb9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

lib/dns.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,14 @@ function errnoException(errorno, syscall) {
2828
// TODO make this more compatible with ErrnoException from src/node.cc
2929
// Once all of Node is using this function the ErrnoException from
3030
// src/node.cc should be removed.
31-
var e = new Error(syscall + ' ' + errorno);
3231

3332
// For backwards compatibility. libuv returns ENOENT on NXDOMAIN.
3433
if (errorno == 'ENOENT') {
3534
errorno = 'ENOTFOUND';
3635
}
3736

37+
var e = new Error(syscall + ' ' + errorno);
38+
3839
e.errno = e.code = errorno;
3940
e.syscall = syscall;
4041
return e;

test/internet/test-dns.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,7 @@ TEST(function test_lookup_failure(done) {
308308
assert.ok(err instanceof Error);
309309
assert.strictEqual(err.errno, dns.NOTFOUND);
310310
assert.strictEqual(err.errno, 'ENOTFOUND');
311+
assert.ok(!/ENOENT/.test(err.message));
311312

312313
done();
313314
});

0 commit comments

Comments
 (0)