diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-02-14 11:08:52 -0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-02-27 20:33:53 +0800 |
commit | fea5dda1d1ee4ebc2883fc9b4019c254176cc2c6 (patch) | |
tree | 6b75a1bb29df23941a3e58fde3331ac9976874ef /lib | |
parent | d2c4f5082f371bbbfc01972d177799dc42e255a9 (diff) | |
download | android-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.js | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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) { |