node/doc/api
Joyee Cheung 6c25f2ea49
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.

PR-URL: https://github.com/nodejs/node/pull/19089
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
2018-03-08 01:14:53 +08:00
..
_toc.md doc: add introduced_in metadata to _toc.md 2018-03-06 09:18:37 +01:00
addons.md doc: update list of re-exported symbols 2018-03-02 10:38:37 -05:00
all.md doc: prepare for v8/V8 linting in doc text 2017-11-22 08:24:46 -08:00
assert.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
async_hooks.md doc: remove Returns: {undefined} 2018-02-26 16:46:55 +02:00
buffer.md buffer: refactor all read/write functions 2018-03-02 19:29:46 +00:00
child_process.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
cli.md doc: replace to Node.js 2018-03-06 00:46:30 +09:00
cluster.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
console.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
crypto.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
debugger.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
deprecations.md util: assign missed deprecation number 2018-03-05 18:10:24 +00:00
dgram.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
dns.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
documentation.md doc: replace to Node.js 2018-03-06 00:46:30 +09:00
domain.md doc: replace to Node.js 2018-03-06 00:46:30 +09:00
errors.md fs: improve errors thrown from fs.watch() 2018-03-08 01:14:53 +08:00
esm.md doc: replace to Node.js 2018-03-06 00:46:30 +09:00
events.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
fs.md doc: add simple example to rename function 2018-03-05 16:52:05 -03:00
globals.md url: expose the WHATWG URL API globally 2018-01-31 16:00:51 +01:00
http2.md doc: remove Returns: {undefined} 2018-02-26 16:46:55 +02:00
http.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
https.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
index.md doc: git mv to .md 2016-04-20 16:34:27 -07:00
inspector.md doc: fix duplicate words & spellings in docs 2017-12-31 18:14:25 +01:00
intl.md doc: add RegExp Unicode Property Escapes to intl 2018-03-02 02:34:37 +02:00
modules.md doc: remove extraneous "for example" text 2018-02-23 02:53:21 +02:00
n-api.md n-api: update documentation 2018-03-07 12:04:16 -05:00
net.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
os.md doc: fix/add link to Android info 2018-02-26 18:27:29 +02:00
path.md doc: remove extraneous "for example" text 2018-02-23 02:53:21 +02:00
perf_hooks.md perf_hooks: fix timing 2018-03-06 07:50:01 -08:00
process.md doc: fix/add link to Android info 2018-02-26 18:27:29 +02:00
punycode.md doc: remove **Note:** tags 2018-02-08 11:57:14 -05:00
querystring.md doc: remove extraneous "for example" text 2018-02-23 02:53:21 +02:00
readline.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
repl.md repl: make last error available as _error 2018-03-04 22:01:57 +00:00
stream.md doc: make suggestion more direct in stream.md 2018-03-06 22:30:09 -08:00
string_decoder.md doc: add links to alternative versions of doc 2017-08-28 11:17:08 +02:00
synopsis.md doc: be more explicit in the sypnosis 2018-02-07 15:06:14 +01:00
timers.md 2018-03-01, Version 9.7.0 (Current) 2018-03-01 20:47:02 +11:00
tls.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
tracing.md doc: replace to Node.js 2018-03-06 00:46:30 +09:00
tty.md doc: linkify missing types 2018-02-01 02:52:31 +02:00
url.md doc: add URL.format() example 2018-03-04 12:47:55 +01:00
util.md util: introduce util.types.is[…] type checks 2018-03-05 17:41:26 +00:00
v8.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
vm.md doc: add new documentation lint rule 2018-02-23 16:26:29 +00:00
zlib.md doc: replace to Node.js 2018-03-06 00:46:30 +09:00