Suggestion: Fail quietly if no notifiers are installed
Closed this issue · 9 comments
Getting "ECONNREFUSED" errors on my Windows 8.1 machine when growl for windows is not installed.
events.js:72
throw er; // Unhandled 'error' event
^
Error: connect ECONNREFUSED
at errnoException (net.js:904:11)
at Object.afterConnect [as oncomplete] (net.js:895:19)
It'd be nice to preserve gulp-notify's console output functionality while making external notification programs optional. (E.g. I'm a fan of the notification systems available on OS X, but am not a fan of Growl for Windows.)
So far I've hacked around it by adding:
.on('error', function(e){
console.log("No notification center found");
})
Thanks for letting me know! This has been on the plan for quite some time now, and I'll fix it as soon as I'm able. I've also have adding the Windows native notification in the backlog.
I'll move this issue to mikaelbr/gulp-notify as thats more correct. node-notifier gives an error to the callback if error is present. That way the consumer can choose to do what ever with the error.
Also, .on('error'.. is not a hack, it's the proper way to handle errors in streams. I've been considering avoiding the error-event to have it fail gracefully instead of having users to handle it. This way CI-systems can be used without opting out the notification.
I see, thanks for the feedback on the on('error') workaround. I haven't worked with streams much before, so I appreciate the discussion points. It does seem odd to deal with an ECONNREFUSED error at the abstraction level of a user of gulp-notify. Perhaps a different error would be a good alternative solution as well (just brainstorming).
I totally agree with the error message. I've released a new version of gulp-notify now. The new version v1.3.0
introduces a concept emitError
as an option. If emitError
is true gulp-notify handles as before, with emitting the error to the stream. If it is false (as it is per default) it simply prints the error message to the console.
Hope this helps! See patch here: mikaelbr/gulp-notify@55751ac
Awesome, and thanks for the handy module, as well!
Hello! It would be great if there would be an option to disable the console print of error message also T_T.
I don't want to see all this
16:30:40] gulp-notify: [Error in notifier] Error in plugin 'gulp-notify' Message: notify-send must be installed on the system.
on my server environment where there is not notifiers
Hi! You can disable gulp-notify on specific environments using env vars. Hope this helps.
Yup, that was what I went with, thank you. Just forgot that I have to use gulp-if
not just if
.
In a stream, you'll need to use gulp-if
to opt in a "blank stream", yeah.