From 8250bfd1e5188d5dada58aedf7a991e959d5eaa9 Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Thu, 11 May 2017 18:52:20 +0300 Subject: [PATCH] fs: Revert throw on invalid callbacks This reverts 4cb5f3daa350421e4eb4622dc818633d3a0659b3 Based on community feedback I think we should consider reverting this change. We should explore how this could be solved via linting rules. Refs: https://github.com/nodejs/node/pull/12562 PR-URL: https://github.com/nodejs/node/pull/12976 Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Evan Lucas Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott --- doc/api/deprecations.md | 5 +- doc/api/fs.md | 180 ++++----------------- lib/fs.js | 60 +++++-- test/fixtures/test-fs-readfile-error.js | 2 +- test/parallel/test-fs-access.js | 4 +- test/parallel/test-fs-link.js | 4 +- test/parallel/test-fs-make-callback.js | 8 +- test/parallel/test-fs-makeStatsCallback.js | 8 +- test/parallel/test-fs-mkdtemp.js | 5 + test/parallel/test-fs-readfile-error.js | 2 +- test/parallel/test-fs-write-no-fd.js | 6 +- 11 files changed, 104 insertions(+), 180 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 82c115d02f1a2a..96e9f927d34b7a 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -150,10 +150,9 @@ explicitly via error event handlers set on the domain instead. ### DEP0013: fs async function without callback -Type: End-of-Life +Type: Runtime -Calling an asynchronous function without a callback will throw a `TypeError` -v8.0.0 onwards. Refer: [PR 12562](https://github.com/nodejs/node/pull/12562) +Calling an asynchronous function without a callback is deprecated. ### DEP0014: fs.read legacy String interface diff --git a/doc/api/fs.md b/doc/api/fs.md index e867e994349945..16311dead4467b 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -551,14 +551,10 @@ checks fail, and does nothing otherwise. * `path` {string|Buffer|URL} @@ -663,10 +655,6 @@ Synchronous chmod(2). Returns `undefined`. * `path` {string|Buffer|URL} @@ -705,14 +693,10 @@ Synchronous chown(2). Returns `undefined`. * `fd` {integer} @@ -1003,14 +987,10 @@ a callback.) * `fd` {integer} @@ -1034,14 +1014,10 @@ Synchronous fchmod(2). Returns `undefined`. * `fd` {integer} @@ -1067,14 +1043,10 @@ Synchronous fchown(2). Returns `undefined`. * `fd` {integer} @@ -1096,14 +1068,10 @@ Synchronous fdatasync(2). Returns `undefined`. * `fd` {integer} @@ -1126,14 +1094,10 @@ Synchronous fstat(2). Returns an instance of [`fs.Stats`][]. * `fd` {integer} @@ -1155,14 +1119,10 @@ Synchronous fsync(2). Returns `undefined`. * `fd` {integer} @@ -1227,14 +1187,10 @@ Synchronous ftruncate(2). Returns `undefined`. * `path` {string|Buffer} @@ -1302,14 +1254,10 @@ Synchronous lchmod(2). Returns `undefined`. * `path` {string|Buffer} @@ -1335,10 +1283,6 @@ Synchronous lchown(2). Returns `undefined`. * `existingPath` {string|Buffer|URL} @@ -1377,10 +1321,6 @@ Synchronous link(2). Returns `undefined`. * `path` {string|Buffer|URL} @@ -1417,10 +1357,6 @@ Synchronous lstat(2). Returns an instance of [`fs.Stats`][]. * `path` {string|Buffer|URL} @@ -1457,14 +1393,10 @@ Synchronous mkdir(2). Returns `undefined`. * `path` {string|Buffer|URL} @@ -1920,10 +1840,6 @@ Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`. * `oldPath` {string|Buffer|URL} @@ -2032,10 +1944,6 @@ Synchronous rename(2). Returns `undefined`. * `path` {string|Buffer|URL} @@ -2070,10 +1978,6 @@ Synchronous rmdir(2). Returns `undefined`. * `path` {string|Buffer|URL} @@ -2166,14 +2070,10 @@ Synchronous symlink(2). Returns `undefined`. * `path` {string|Buffer} @@ -2199,10 +2099,6 @@ passed as the first argument. In this case, `fs.ftruncateSync()` is called. * `path` {string|Buffer|URL} @@ -2256,10 +2152,6 @@ when possible. * `fd` {integer} @@ -2526,17 +2414,13 @@ the end of the file. * `fd` {integer} @@ -2574,17 +2458,13 @@ the end of the file.