From fe0b8d9eebbd9c451e417a144abbe664a0970e68 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 20 Apr 2017 14:39:06 +0200 Subject: [PATCH 1/3] src: remove uv errno This commit attempts to take care of a TODO reported in issue 4641. I'm not sure if just removing errno is an option, as there might be code that is depending on this errno being availble. If it cannot be removed perhaps the TODO can. Hopefully feedback on this commit will sort that out. Refs: https://github.com/nodejs/node/issues/4641 --- src/node.cc | 3 --- test/parallel/test-domain-implicit-fs.js | 1 - test/parallel/test-domain.js | 2 -- 3 files changed, 6 deletions(-) diff --git a/src/node.cc b/src/node.cc index 4913147619e8..e10a42376761 100644 --- a/src/node.cc +++ b/src/node.cc @@ -940,9 +940,6 @@ Local UVException(Isolate* isolate, Local e = Exception::Error(js_msg)->ToObject(isolate); - // TODO(piscisaureus) errno should probably go; the user has no way of - // knowing which uv errno value maps to which error. - e->Set(env->errno_string(), Integer::New(isolate, errorno)); e->Set(env->code_string(), js_code); e->Set(env->syscall_string(), js_syscall); if (!js_path.IsEmpty()) diff --git a/test/parallel/test-domain-implicit-fs.js b/test/parallel/test-domain-implicit-fs.js index 6e4127763ce5..ff35e2eb354b 100644 --- a/test/parallel/test-domain-implicit-fs.js +++ b/test/parallel/test-domain-implicit-fs.js @@ -36,7 +36,6 @@ d.on('error', common.mustCall(function(er) { assert.ok(!er.domainEmitter); assert.strictEqual(er.code, 'ENOENT'); assert.ok(/\bthis file does not exist\b/i.test(er.path)); - assert.strictEqual(typeof er.errno, 'number'); })); diff --git a/test/parallel/test-domain.js b/test/parallel/test-domain.js index fad71b0427b4..0be8411ae614 100644 --- a/test/parallel/test-domain.js +++ b/test/parallel/test-domain.js @@ -77,12 +77,10 @@ d.on('error', function(er) { assert.ok(!er.domainEmitter); assert.strictEqual(er.code, 'ENOENT'); assert.strictEqual(er_path, 'this file does not exist'); - assert.strictEqual(typeof er.errno, 'number'); break; case "ENOENT: no such file or directory, open 'stream for nonexistent file'": - assert.strictEqual(typeof er.errno, 'number'); assert.strictEqual(er.code, 'ENOENT'); assert.strictEqual(er_path, 'stream for nonexistent file'); assert.strictEqual(er.domain, d); From 8d40cdc0a488a76e28e26a031eefd08e63b55634 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 20 Apr 2017 20:20:02 +0200 Subject: [PATCH 2/3] Revert "src: remove uv errno" This reverts commit fe0b8d9eebbd9c451e417a144abbe664a0970e68. --- src/node.cc | 3 +++ test/parallel/test-domain-implicit-fs.js | 1 + test/parallel/test-domain.js | 2 ++ 3 files changed, 6 insertions(+) diff --git a/src/node.cc b/src/node.cc index e10a42376761..4913147619e8 100644 --- a/src/node.cc +++ b/src/node.cc @@ -940,6 +940,9 @@ Local UVException(Isolate* isolate, Local e = Exception::Error(js_msg)->ToObject(isolate); + // TODO(piscisaureus) errno should probably go; the user has no way of + // knowing which uv errno value maps to which error. + e->Set(env->errno_string(), Integer::New(isolate, errorno)); e->Set(env->code_string(), js_code); e->Set(env->syscall_string(), js_syscall); if (!js_path.IsEmpty()) diff --git a/test/parallel/test-domain-implicit-fs.js b/test/parallel/test-domain-implicit-fs.js index ff35e2eb354b..6e4127763ce5 100644 --- a/test/parallel/test-domain-implicit-fs.js +++ b/test/parallel/test-domain-implicit-fs.js @@ -36,6 +36,7 @@ d.on('error', common.mustCall(function(er) { assert.ok(!er.domainEmitter); assert.strictEqual(er.code, 'ENOENT'); assert.ok(/\bthis file does not exist\b/i.test(er.path)); + assert.strictEqual(typeof er.errno, 'number'); })); diff --git a/test/parallel/test-domain.js b/test/parallel/test-domain.js index 0be8411ae614..fad71b0427b4 100644 --- a/test/parallel/test-domain.js +++ b/test/parallel/test-domain.js @@ -77,10 +77,12 @@ d.on('error', function(er) { assert.ok(!er.domainEmitter); assert.strictEqual(er.code, 'ENOENT'); assert.strictEqual(er_path, 'this file does not exist'); + assert.strictEqual(typeof er.errno, 'number'); break; case "ENOENT: no such file or directory, open 'stream for nonexistent file'": + assert.strictEqual(typeof er.errno, 'number'); assert.strictEqual(er.code, 'ENOENT'); assert.strictEqual(er_path, 'stream for nonexistent file'); assert.strictEqual(er.domain, d); From c93e1ea4e4e23d2c278adc5cb91d34054fc9eae6 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 20 Apr 2017 20:24:19 +0200 Subject: [PATCH 3/3] src: remove TODO about uv errno removal This commit removes a TODO regarding the removal of uv errno. errno is currently used and cannot be removed so removing the comment to avoid any confusion. --- src/node.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/node.cc b/src/node.cc index 4913147619e8..b432df3b7511 100644 --- a/src/node.cc +++ b/src/node.cc @@ -940,8 +940,6 @@ Local UVException(Isolate* isolate, Local e = Exception::Error(js_msg)->ToObject(isolate); - // TODO(piscisaureus) errno should probably go; the user has no way of - // knowing which uv errno value maps to which error. e->Set(env->errno_string(), Integer::New(isolate, errorno)); e->Set(env->code_string(), js_code); e->Set(env->syscall_string(), js_syscall);