yuanchuan / node-watch

A wrapper and enhancements for fs.watch
https://npm.im/node-watch
MIT License
341 stars 44 forks source link

Fix can't listener error event on incorrect file/directory #123

Closed leijuns closed 2 years ago

leijuns commented 2 years ago

Fix can't listener error event on incorrect file/directory.

Like this:

const watcher = watch('incorrect-some-file-path', function(evt, name) {
  //do something
});
watcher.on('error', () => {
  //do something
});

expose error:

events.js:353
      throw er; // Unhandled 'error' event
yuanchuan commented 2 years ago

Thank you for the patch! Would you fix the test?

leijuns commented 2 years ago

Fix test case, you can approval it.