summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJoyee Cheung <joyeec9h3@gmail.com>2018-01-24 09:37:52 +0800
committerJoyee Cheung <joyeec9h3@gmail.com>2018-02-01 15:52:40 +0800
commitf5e287ba208b8d9eed3c850577ff9a46d9935d9a (patch)
treed7cc63fb647561a427214d5c4695d40670020fc4 /lib
parentb3a7df7c6dddcc4aaf2106d569a2a4c017e9699c (diff)
downloadandroid-node-v8-f5e287ba208b8d9eed3c850577ff9a46d9935d9a.tar.gz
android-node-v8-f5e287ba208b8d9eed3c850577ff9a46d9935d9a.tar.bz2
android-node-v8-f5e287ba208b8d9eed3c850577ff9a46d9935d9a.zip
fs: throw errors from fs.fdatasyncSync 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.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/fs.js b/lib/fs.js
index 8eaba7984c..49e550fe3d 100644
--- a/lib/fs.js
+++ b/lib/fs.js
@@ -1029,7 +1029,11 @@ fs.fdatasync = function(fd, callback) {
fs.fdatasyncSync = function(fd) {
validateUint32(fd, 'fd');
- return binding.fdatasync(fd);
+ const ctx = {};
+ binding.fdatasync(fd, undefined, ctx);
+ if (ctx.errno !== undefined) {
+ throw new errors.uvException(ctx);
+ }
};
fs.fsync = function(fd, callback) {