From e9f2cecf1a14285574f9b6104dd690ef92495d74 Mon Sep 17 00:00:00 2001 From: Ruben Bridgewater Date: Fri, 9 Feb 2018 00:54:31 +0100 Subject: [PATCH] Revert "fs: Revert throw on invalid callbacks" MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 8250bfd1e5188d5dada58aedf7a991e959d5eaa9. PR-URL: https://github.com/nodejs/node/pull/18668 Refs: https://github.com/nodejs/node/pull/12562 Refs: https://github.com/nodejs/node/pull/12976 Reviewed-By: Matteo Collina Reviewed-By: Michaƫl Zasso Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell Reviewed-By: Joyee Cheung Reviewed-By: Gus Caplan --- doc/api/deprecations.md | 5 +- doc/api/fs.md | 180 +++++++++++++++++---- lib/fs.js | 54 +------ test/fixtures/test-fs-readfile-error.js | 2 +- test/parallel/test-fs-access.js | 3 +- test/parallel/test-fs-append-file.js | 9 +- test/parallel/test-fs-exists.js | 7 +- test/parallel/test-fs-fchmod.js | 2 +- test/parallel/test-fs-make-callback.js | 6 - test/parallel/test-fs-makeStatsCallback.js | 6 - test/parallel/test-fs-mkdtemp.js | 5 - test/parallel/test-fs-readfile-error.js | 4 +- test/parallel/test-fs-write-no-fd.js | 6 +- 13 files changed, 173 insertions(+), 116 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 8b38a7863ccd94..651e5d1cf98e7a 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -162,9 +162,10 @@ explicitly via error event handlers set on the domain instead. ### DEP0013: fs asynchronous function without callback -Type: Runtime +Type: End-of-Life -Calling an asynchronous function without a callback is deprecated. +Calling an asynchronous function without a callback throws a `TypeError` +REPLACEME onwards. Refer: [PR 12562](https://github.com/nodejs/node/pull/12562) ### DEP0014: fs.read legacy String interface diff --git a/doc/api/fs.md b/doc/api/fs.md index e5ffae410a970e..f33bbe47851b58 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -819,10 +819,14 @@ try { * `path` {string|Buffer|URL} @@ -1018,6 +1026,10 @@ See also: chmod(2) * `path` {string|Buffer|URL} @@ -1062,10 +1074,14 @@ See also: chown(2) * `fd` {integer} @@ -1444,10 +1460,14 @@ a callback.) * `fd` {integer} @@ -1472,10 +1492,14 @@ Synchronous fchmod(2). Returns `undefined`. * `fd` {integer} @@ -1502,10 +1526,14 @@ Synchronous fchown(2). Returns `undefined`. * `fd` {integer} @@ -1528,10 +1556,14 @@ Synchronous fdatasync(2). Returns `undefined`. * `fd` {integer} @@ -1557,10 +1589,14 @@ Synchronous fstat(2). Returns an instance of [`fs.Stats`][]. * `fd` {integer} @@ -1583,10 +1619,14 @@ Synchronous fsync(2). Returns `undefined`. * `fd` {integer} @@ -1652,10 +1692,14 @@ Synchronous ftruncate(2). Returns `undefined`. * `path` {string|Buffer|URL} @@ -1724,10 +1772,14 @@ Synchronous lchmod(2). Returns `undefined`. * `path` {string|Buffer|URL} @@ -1754,6 +1806,10 @@ Synchronous lchown(2). Returns `undefined`. * `existingPath` {string|Buffer|URL} @@ -1793,6 +1849,10 @@ Synchronous link(2). Returns `undefined`. * `path` {string|Buffer|URL} @@ -1832,6 +1892,10 @@ Synchronous lstat(2). Returns an instance of [`fs.Stats`][]. * `path` {string|Buffer|URL} @@ -1874,10 +1938,14 @@ See also: mkdir(2) * `path` {string|Buffer|URL} @@ -2365,6 +2445,10 @@ Synchronous version of [`fs.read()`][]. Returns the number of `bytesRead`. * `oldPath` {string|Buffer|URL} @@ -2557,6 +2645,10 @@ Synchronous rename(2). Returns `undefined`. * `path` {string|Buffer|URL} @@ -2598,6 +2690,10 @@ on Windows and an `ENOTDIR` error on POSIX. * `path` {string|Buffer|URL} @@ -2694,10 +2790,14 @@ Synchronous symlink(2). Returns `undefined`. * `path` {string|Buffer|URL} @@ -2730,6 +2830,10 @@ in the future. * `path` {string|Buffer|URL} @@ -2798,6 +2902,10 @@ and `fs.unwatchFile()` when possible. * `fd` {integer} @@ -3080,13 +3192,17 @@ the end of the file. * `fd` {integer} @@ -3127,13 +3243,17 @@ the end of the file.