fs: improve errors from watch, watchFile and unwatchFile#19345
Closed
joyeecheung wants to merge 2 commits intonodejs:masterfrom
Closed
fs: improve errors from watch, watchFile and unwatchFile#19345joyeecheung wants to merge 2 commits intonodejs:masterfrom
joyeecheung wants to merge 2 commits intonodejs:masterfrom
Conversation
- Remove ERR_FS_WATCHER_ALREADY_STARTED and ERR_FS_WATCHER_NOT_STARTED because those two situations should result in noop instead of errors for consistency with the documented behavior of fs.watchFile. This partially reverts nodejs#19089 - Update comments about this behavior. Refs: nodejs#19089
- Check if the watcher is active in JS land before invoking the binding, act as a noop if the state of the watcher does not match the expectation. This avoids firing 'stop' when the watcher is already stopped. - Update comments, validate more arguments and the type of the handle. - Handle the errors from uv_fs_poll_start - Create an `IsActive` helper method on StatWatcher
Member
Author
|
CI: https://ci.nodejs.org/job/node-test-pull-request/13675/ cc @nodejs/tsc this is semver-major because of the additional throw. Please review, thanks! |
jasnell
approved these changes
Mar 15, 2018
Member
Author
|
@nodejs/tsc this needs one more approval to land..thanks! |
targos
approved these changes
Mar 18, 2018
Member
Author
Member
Author
|
Landed in 897cec4...897f7b6, thanks! |
joyeecheung
added a commit
that referenced
this pull request
Mar 18, 2018
- Remove ERR_FS_WATCHER_ALREADY_STARTED and ERR_FS_WATCHER_NOT_STARTED because those two situations should result in noop instead of errors for consistency with the documented behavior of fs.watchFile. This partially reverts #19089 - Update comments about this behavior. Refs: #19089 PR-URL: #19345 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
joyeecheung
added a commit
that referenced
this pull request
Mar 18, 2018
- Check if the watcher is active in JS land before invoking the binding, act as a noop if the state of the watcher does not match the expectation. This avoids firing 'stop' when the watcher is already stopped. - Update comments, validate more arguments and the type of the handle. - Handle the errors from uv_fs_poll_start - Create an `IsActive` helper method on StatWatcher PR-URL: #19345 Refs: #19089 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Matteo Collina <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
fs: remove watcher state errors for fs.watch
ERR_FS_WATCHER_NOT_STARTED because those two situations should
result in noop instead of errors for consistency with the
documented behavior of fs.watchFile.
This partially reverts fs: improve errors thrown from fs.watch() #19089
Refs: #19089
fs: improve errors in watchFile and unwatchFile
invoking the binding, act as a noop if the state of
the watcher does not match the expectation. This
avoids firing 'stop' when the watcher is already
stopped.
the type of the handle.
IsActivehelper method on StatWatcherChecklist
make -j4 test(UNIX), orvcbuild test(Windows) passes