summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-02-14 11:08:52 -0800
committerJoyee Cheung <joyeec9h3@gmail.com>2018-02-27 20:33:53 +0800
commitfea5dda1d1ee4ebc2883fc9b4019c254176cc2c6 (patch)
tree6b75a1bb29df23941a3e58fde3331ac9976874ef /lib
parentd2c4f5082f371bbbfc01972d177799dc42e255a9 (diff)
downloadandroid-node-v8-fea5dda1d1ee4ebc2883fc9b4019c254176cc2c6.tar.gz
android-node-v8-fea5dda1d1ee4ebc2883fc9b4019c254176cc2c6.tar.bz2
android-node-v8-fea5dda1d1ee4ebc2883fc9b4019c254176cc2c6.zip
fs: throw openSync errors in JS
PR-URL: https://github.com/nodejs/node/pull/18871 Refs: https://github.com/nodejs/node/issues/18106 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Diffstat (limited to 'lib')
-rw-r--r--lib/fs.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/fs.js b/lib/fs.js
index 7e80bb6800..60134b1c32 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -521,8 +521,12 @@ fs.openSync = function(path, flags, mode) {
validatePath(path);
validateUint32(mode, 'mode');
- return binding.open(pathModule.toNamespacedPath(path),
- stringToFlags(flags), mode);
+ const ctx = { path };
+ const result = binding.open(pathModule.toNamespacedPath(path),
+ stringToFlags(flags), mode,
+ undefined, ctx);
+ handleErrorFromBinding(ctx);
+ return result;
};
fs.read = function(fd, buffer, offset, length, position, callback) {