Skip to content

Commit

Permalink
fs: make fs.watch error message more useful
Browse files Browse the repository at this point in the history
PR-URL: #5616
Reviewed-By: Ben Noordhuis <[email protected]>
Reviewed-By: Trevor Norris <[email protected]>
  • Loading branch information
jasnell committed Mar 25, 2016
1 parent 060e5f0 commit 53a95a5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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:`);

This comment has been minimized.

Copy link
@Fishrock123

Fishrock123 Mar 30, 2016

Contributor

Why is there a colon at these end of these?

This comment has been minimized.

Copy link
@cjihrig

cjihrig Mar 30, 2016

Contributor

I believe errnoException() appends the error associated with status to the end of the string.

error.filename = filename;
self.emit('error', error);
} else {
Expand Down

0 comments on commit 53a95a5

Please sign in to comment.