diff options
author | Myles Borins <mborins@us.ibm.com> | 2016-07-22 16:38:36 -0700 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2016-08-05 00:13:29 +0200 |
commit | 21b0a27af8b0a171f0a3a2a365259706bccfe1a5 (patch) | |
tree | 751489abda758420e504e1a20344264f7deda4e3 /test/parallel/test-fs-make-callback.js | |
parent | 1a9e247c794274942683d2e77db098c9494ddde5 (diff) | |
download | node-new-21b0a27af8b0a171f0a3a2a365259706bccfe1a5.tar.gz |
Revert "fs: make callback mandatory to all async functions"
This reverts commit 9359de9dd2eae06ed5afcb75dad9bd4c466eb69d.
Original Commit Message:
The "fs" module has two functions called `maybeCallback` and
`makeCallback`, as of now.
The `maybeCallback` creates a default function to report errors, if the
parameter passed is not a function object. Basically, if the callback
is omitted in some cases, this function is used to create a default
callback function.
The `makeCallback`, OTOH, creates a default function only if the
parameter passed is `undefined`, and if it is not a function object it
will throw an `Error`.
This patch removes the `maybeCallback` function and makes the callback
function argument mandatory for all the async functions.
PR-URL: https://github.com/nodejs/node/pull/7168
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/7846
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-make-callback.js')
-rw-r--r-- | test/parallel/test-fs-make-callback.js | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/test/parallel/test-fs-make-callback.js b/test/parallel/test-fs-make-callback.js index 8ded34e2b0..4fbe64437e 100644 --- a/test/parallel/test-fs-make-callback.js +++ b/test/parallel/test-fs-make-callback.js @@ -13,6 +13,9 @@ function test(cb) { // Verify the case where a callback function is provided assert.doesNotThrow(test(function() {})); +// Passing undefined calls rethrow() internally, which is fine +assert.doesNotThrow(test(undefined)); + // Anything else should throw assert.throws(test(null)); assert.throws(test(true)); |