fs: make fs.watch error message more useful
PR-URL: https://github.com/nodejs/node/pull/5616 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
parent
060e5f0c00
commit
53a95a5b12
@ -1382,7 +1382,10 @@ function FSWatcher() {
|
||||
this._handle.onchange = function(status, event, filename) {
|
||||
if (status < 0) {
|
||||
self._handle.close();
|
||||
const error = errnoException(status, `watch ${filename}`);
|
||||
const error = !filename ?
|
||||
errnoException(status, 'Error watching file for changes:') :
|
||||
errnoException(status,
|
||||
`Error watching file ${filename} for changes:`);
|
||||
error.filename = filename;
|
||||
self.emit('error', error);
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user