Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34.2k
fs: warn instead of throwing if no callback#7897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fs: warn instead of throwing if no callback #7897
Uh oh!
There was an error while loading. Please reload this page.
Conversation
thefourtheye commented Jul 27, 2016
lib/fs.js Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: are deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
MylesBorins commented Jul 27, 2016
citgm: https://ci.nodejs.org/view/Node.js-citgm/job/thealphanerd-smoker-xunit/39/ I like the approach here. +1 for this over the revert |
lib/fs.js Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did remember the other TODO/FIXME/etc.'s format is not like this, suggest:
// TODO(thefourtheye): throw error instead of deprecation warning in v8.0.0There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
claudiorodriguez commented Jul 28, 2016
citgm failing: |
thefourtheye commented Jul 28, 2016
Do you guys know how I can locally reproduce this problem? |
targos commented Jul 28, 2016
|
thefourtheye commented Jul 28, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Wait, this should not fail though. I'll investigate further, a little later. |
lib/fs.js Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just compare cb === undefined.
jasnell commented Aug 4, 2016
A test case validating that the deprecation warning is emitted would be good. With that added this LGTM |
addaleax commented Aug 4, 2016
@thefourtheye As expected, this conflicts now… I think it’s okay to apply the changes that got reverted here again (with the intention to squash in the warnings?). Sorry for the trouble the process is causing you! |
jasnell commented Aug 9, 2016
ping @thefourtheye |
3b0ece0 to c2d6f53Comparethefourtheye commented Aug 12, 2016
Updated with the deprecation warning alone. PTAL people. |
lib/fs.js Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are deprecated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or even better, make it singular.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@silverwind Done.
jasnell commented Aug 18, 2016 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Actually, let me take that back... this uses For instance: process.emitWarning(depMessage,'DeprecationWarning');By passing ping @thefourtheye |
c2d6f53 to 5b8a2e4Comparethefourtheye commented Aug 19, 2016
@jasnell I modified it to use |
jasnell commented Aug 19, 2016
@thefourtheye ... That partially handles it. See #8166. I'm attempting to move things away from using the internal util printDeprecationMessage. |
fe1b569 to c8b8d4bComparejasnell commented Aug 26, 2016
LGTM with a nit if CI is green. |
This patch issues a deprecation warning, if an asynchronous function is called without a callback function.
5ff4aa2 to 3e97e2cComparethefourtheye commented Aug 26, 2016
yorkie commented Aug 26, 2016
LGTM if CI is green |
jasnell commented Aug 26, 2016
@nodejs/ctc ... as a semver-major this needs another CTC signoff... |
addaleax commented Aug 27, 2016
LGTM |
thefourtheye commented Aug 27, 2016
Thanks for the review people. Landed in f8f283b |
This patch issues a deprecation warning, if an asynchronous function is called without a callback function. PR-URL: #7897 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Yorkie Liu <[email protected]> Reviewed-By: Anna Henningsen <[email protected]>
Notable Changes: * Buffer * Passing invalid input to Buffer.byteLength will now throw an error [nodejs#8946](nodejs#8946). * Calling Buffer without new is now deprecated and will emit a process warning [nodejs#8169](nodejs#8169). * Passing a negative number to allocUnsafe will now throw an error [nodejs#7079](nodejs#7079). * Child Process * The fork and execFile methods now have stronger argument validation [nodejs#7399](nodejs#7399). * Cluster * The worker.suicide method is deprecated and will emit a process warning [nodejs#3747](nodejs#3747). * Deps * V8 has been updated to 5.4.500.36 [nodejs#8317](nodejs#8317), [nodejs#8852](nodejs#8852), [nodejs#9253](nodejs#9253). * NODE_MODULE_VERSION has been updated to 51 [nodejs#8808](nodejs#8808). * File System * A process warning is emitted if a callback is not passed to async file system methods [nodejs#7897](nodejs#7897). * Intl * Intl.v8BreakIterator constructor has been deprecated and will emit a process warning [nodejs#8908](nodejs#8908). * Promises * Unhandled Promise rejections have been deprecated and will emit a process warning [nodejs#8217](nodejs#8217). * Punycode * The `punycode` module has been deprecated [nodejs#7941](nodejs#7941). * URL * An Experimental WHATWG URL Parser has been introduced [nodejs#7448](nodejs#7448).
Notable Changes: * Buffer * Passing invalid input to Buffer.byteLength will now throw an error [#8946](#8946). * Calling Buffer without new is now deprecated and will emit a process warning [#8169](#8169). * Passing a negative number to allocUnsafe will now throw an error [#7079](#7079). * Child Process * The fork and execFile methods now have stronger argument validation [#7399](#7399). * Cluster * The worker.suicide method is deprecated and will emit a process warning [#3747](#3747). * Deps * V8 has been updated to 5.4.500.36 [#8317](#8317), [#8852](#8852), [#9253](#9253). * NODE_MODULE_VERSION has been updated to 51 [#8808](#8808). * File System * A process warning is emitted if a callback is not passed to async file system methods [#7897](#7897). * Intl * Intl.v8BreakIterator constructor has been deprecated and will emit a process warning [#8908](#8908). * Promises * Unhandled Promise rejections have been deprecated and will emit a process warning [#8217](#8217). * Punycode * The `punycode` module has been deprecated [#7941](#7941). * URL * An Experimental WHATWG URL Parser has been introduced [#7448](#7448). PR-URL: #9099
Notable Changes: * Buffer * Passing invalid input to Buffer.byteLength will now throw an error [#8946](#8946). * Calling Buffer without new is now deprecated and will emit a process warning [#8169](#8169). * Passing a negative number to allocUnsafe will now throw an error [#7079](#7079). * Child Process * The fork and execFile methods now have stronger argument validation [#7399](#7399). * Cluster * The worker.suicide method is deprecated and will emit a process warning [#3747](#3747). * Deps * V8 has been updated to 5.4.500.36 [#8317](#8317), [#8852](#8852), [#9253](#9253). * NODE_MODULE_VERSION has been updated to 51 [#8808](#8808). * File System * A process warning is emitted if a callback is not passed to async file system methods [#7897](#7897). * Intl * Intl.v8BreakIterator constructor has been deprecated and will emit a process warning [#8908](#8908). * Promises * Unhandled Promise rejections have been deprecated and will emit a process warning [#8217](#8217). * Punycode * The `punycode` module has been deprecated [#7941](#7941). * URL * An Experimental WHATWG URL Parser has been introduced [#7448](#7448). PR-URL: #9099
Notable Changes: * Buffer * Passing invalid input to Buffer.byteLength will now throw an error [#8946](nodejs/node#8946). * Calling Buffer without new is now deprecated and will emit a process warning [#8169](nodejs/node#8169). * Passing a negative number to allocUnsafe will now throw an error [#7079](nodejs/node#7079). * Child Process * The fork and execFile methods now have stronger argument validation [#7399](nodejs/node#7399). * Cluster * The worker.suicide method is deprecated and will emit a process warning [#3747](nodejs/node#3747). * Deps * V8 has been updated to 5.4.500.36 [#8317](nodejs/node#8317), [#8852](nodejs/node#8852), [#9253](nodejs/node#9253). * NODE_MODULE_VERSION has been updated to 51 [#8808](nodejs/node#8808). * File System * A process warning is emitted if a callback is not passed to async file system methods [#7897](nodejs/node#7897). * Intl * Intl.v8BreakIterator constructor has been deprecated and will emit a process warning [#8908](nodejs/node#8908). * Promises * Unhandled Promise rejections have been deprecated and will emit a process warning [#8217](nodejs/node#8217). * Punycode * The `punycode` module has been deprecated [#7941](nodejs/node#7941). * URL * An Experimental WHATWG URL Parser has been introduced [#7448](nodejs/node#7448). Signed-off-by: Ilkka Myller <[email protected]>
Checklist
make -j4 test(UNIX), orvcbuild test nosign(Windows) passesAffected core subsystem(s)
fs
Description of change
9359de9
made sure that if no callback function is passed to asynchronous
functions, the system will throw.
But, this breaks a lot of existing modules including npm (Refer:
#7846). Till all the necessary
dependencies use the async functions properly, no module can work.
So, this patch issues a deprecation warning, instead of throwing and
the throwing behaviour will be restored in the next major release.
cc @ChALkeR @nodejs/collaborators @nodejs/ctc