dns: make error message match errno
This commit is contained in:
parent
31583be042
commit
7295bb9435
@ -28,13 +28,14 @@ function errnoException(errorno, syscall) {
|
|||||||
// TODO make this more compatible with ErrnoException from src/node.cc
|
// TODO make this more compatible with ErrnoException from src/node.cc
|
||||||
// Once all of Node is using this function the ErrnoException from
|
// Once all of Node is using this function the ErrnoException from
|
||||||
// src/node.cc should be removed.
|
// src/node.cc should be removed.
|
||||||
var e = new Error(syscall + ' ' + errorno);
|
|
||||||
|
|
||||||
// For backwards compatibility. libuv returns ENOENT on NXDOMAIN.
|
// For backwards compatibility. libuv returns ENOENT on NXDOMAIN.
|
||||||
if (errorno == 'ENOENT') {
|
if (errorno == 'ENOENT') {
|
||||||
errorno = 'ENOTFOUND';
|
errorno = 'ENOTFOUND';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var e = new Error(syscall + ' ' + errorno);
|
||||||
|
|
||||||
e.errno = e.code = errorno;
|
e.errno = e.code = errorno;
|
||||||
e.syscall = syscall;
|
e.syscall = syscall;
|
||||||
return e;
|
return e;
|
||||||
|
@ -308,6 +308,7 @@ TEST(function test_lookup_failure(done) {
|
|||||||
assert.ok(err instanceof Error);
|
assert.ok(err instanceof Error);
|
||||||
assert.strictEqual(err.errno, dns.NOTFOUND);
|
assert.strictEqual(err.errno, dns.NOTFOUND);
|
||||||
assert.strictEqual(err.errno, 'ENOTFOUND');
|
assert.strictEqual(err.errno, 'ENOTFOUND');
|
||||||
|
assert.ok(!/ENOENT/.test(err.message));
|
||||||
|
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user