Skip to content
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: improve errors thrown from fs.watch() #19089

Closed
wants to merge 2 commits into from

Commits on Mar 6, 2018

  1. fs: improve errors thrown from fs.watch()

    - Add an accessor property `initialized `to FSEventWrap to
      check the state of the handle from the JS land
    - Introduce ERR_FS_WATCHER_ALREADY_STARTED so calling start()
      on a watcher that is already started will throw instead of
      doing nothing silently.
    - Introduce ERR_FS_WATCHER_NOT_STARTED so calling close()
      on a watcher that is already closed will throw instead of
      doing nothing silently.
    - Validate the filename passed to fs.watch()
    - Assert that the handle in the watcher are instances of
      FSEvent instead of relying on the illegal invocation error
      from the VM.
    - Add more assertions in FSEventWrap methods now that we check
      `initialized` and the filename in JS land before invoking
      the binding.
    - Use uvException instead of errornoException to create
      the errors with the error numbers from libuv to make them
      consistent with other errors in fs.
    
    TODO:
    
    - Improve fs.watchFile() the same way this patch improves fs.watch()
    - It seems possible to fire both rename and change event from libuv
      together now that we can check if the handle is closed via
      `initialized` in JS land.
    joyeecheung committed Mar 6, 2018
    Configuration menu
    Copy the full SHA
    8a7f606 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    32c7e59 View commit details
    Browse the repository at this point in the history