Skip to content
Permalink
Browse files

fs: make fs.watch error message more useful

PR-URL: #5616
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
  • Loading branch information...
jasnell committed Mar 18, 2016
1 parent 060e5f0 commit 53a95a5b12fbbfc8d465689e43aa77da32e5d0f3
Showing with 4 additions and 1 deletion.
  1. +4 −1 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:`);

This comment has been minimized.

Copy link
@Fishrock123

Fishrock123 Mar 30, 2016

Member

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 {

0 comments on commit 53a95a5

Please sign in to comment.
You can’t perform that action at this time.