lucagrulla / node-tail

The zero dependency Node.js module for tailing a file
https://www.lucagrulla.com/node-tail/
MIT License
467 stars 75 forks source link

Add try/catch to watchEvent #146

Closed chriskinsman closed 2 years ago

chriskinsman commented 2 years ago

The watchEvent method is an event handler for fs.watch().

It has no try/catch handler around it. When change() throws due to a ENOENT there is nothing to catch the exception which causes the process to terminate.

Added a try/catch around watchEvent and both log and emit any errors that are raised.

143