diff options
author | Joyee Cheung <joyeec9h3@gmail.com> | 2018-01-24 09:20:30 +0800 |
---|---|---|
committer | Joyee Cheung <joyeec9h3@gmail.com> | 2018-02-01 15:52:36 +0800 |
commit | b3a7df7c6dddcc4aaf2106d569a2a4c017e9699c (patch) | |
tree | 24b3501b3f0c78e81272e0191362d3d8d3cc2ed9 /lib | |
parent | 5583981c5296be0383c934caf0c0ddd5e6bda379 (diff) | |
download | android-node-v8-b3a7df7c6dddcc4aaf2106d569a2a4c017e9699c.tar.gz android-node-v8-b3a7df7c6dddcc4aaf2106d569a2a4c017e9699c.tar.bz2 android-node-v8-b3a7df7c6dddcc4aaf2106d569a2a4c017e9699c.zip |
fs: throw errors from fs.ftruncateSync in JS
PR-URL: https://github.com/nodejs/node/pull/18348
Refs: https://github.com/nodejs/node/issues/18106
Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/fs.js | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -995,7 +995,11 @@ fs.ftruncateSync = function(fd, len = 0) { validateUint32(fd, 'fd'); validateLen(len); len = Math.max(0, len); - return binding.ftruncate(fd, len); + const ctx = {}; + binding.ftruncate(fd, len, undefined, ctx); + if (ctx.errno !== undefined) { + throw new errors.uvException(ctx); + } }; fs.rmdir = function(path, callback) { |