From 437c75649335a0b412670b82d3dfc37be7b01d0b Mon Sep 17 00:00:00 2001 From: Joyee Cheung Date: Mon, 19 Feb 2018 17:09:41 +0800 Subject: fs: throw fs.chmodSync errors in JS land MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/18871 Refs: https://github.com/nodejs/node/issues/18106 Reviewed-By: Michaƫl Zasso Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater --- lib/fs.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib/fs.js') diff --git a/lib/fs.js b/lib/fs.js index 60134b1c32..0d8d8ec4dc 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1054,7 +1054,9 @@ fs.chmodSync = function(path, mode) { validatePath(path); mode = modeNum(mode); validateUint32(mode, 'mode'); - return binding.chmod(pathModule.toNamespacedPath(path), mode); + const ctx = { path }; + binding.chmod(pathModule.toNamespacedPath(path), mode, undefined, ctx); + handleErrorFromBinding(ctx); }; if (constants.O_SYMLINK !== undefined) { -- cgit v1.2.3