diff --git a/lib/fs.js b/lib/fs.js index f4a31a6f4d44c2..bfb7d874f7d71f 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -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 {