mikaelbr / gulp-notify

gulp plugin to send messages based on Vinyl Files or Errors to Mac OS X, Linux or Windows using the node-notifier module. Fallbacks to Growl or simply logging
MIT License
592 stars 40 forks source link

Priority and icon in onError #69

Open Evaske opened 9 years ago

Evaske commented 9 years ago

Hey,

I'm trying to get an icon and priority set in the onError but can't seem to get it to work no matter what I try.

.on("error", plugins.notify.onError({
        message: "<%= error.message %>",
        title: "Error Compiling",
        priority: 10,
        "icon": path.join(__dirname, 'node_modules/gulp-notify/assets', 'gulp.png')
    }))

This code works if it is a normal notify message but not if it is being done as an error. Am I doing something wrong to allow me to set the priority and icon for an error message?

Or even just the inverted icon like I've seen should happen on an error. That isn't showing for me. I'm using Snarl on Windows 7.

jpcmf commented 9 years ago

I have a similar problem using gulp-ruby-sass and gulp-notify. The error message don't appear anymore only the success message.

mikaelbr commented 9 years ago

@Evaske The notification works, but the icon and priority doesn't? And this happens only onError?

Could you try printing out options on this line: https://github.com/mikaelbr/gulp-notify/blob/master/lib/report.js#L32 To see if all options are set correctly.

Evaske commented 9 years ago

@mikaelbr Yes the notification works but there is no icon and priority doesn't seem to get set, it just shows as a black notification.

I will do that print out for you. Bare with me.

I did manage to get the priority working using the following code but this doesn't output any icon:

.on("error", plugins.notify.onError({
        message: "<%= error.message %>",
        title: "Error Compiling",
        priority: 10,
        label: "Error"
    }))

Using just this from the gulp website code:

.on("error", notify.onError(function (error) {
    return "Message to the notifier: " + error.message;
  }));

Produces a normal black box and no icon.

Output from options

    { icon: <Buffer 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 02 02 00 0
0 02 02 08 06 00 00 00 bd 45 a5 cc 00 00 27 ab 49 44 41 54 78 da ed dd ed 6d 1b
bb b6 80 ...>,
      sound: 'Frog',
      title: 'Error running Gulp',
      message: 'Message to the notifier:     error sass/build.scss (Line 32: Invalid
     CSS after "    padding": expected ";", was ": 10px;")\r\nCompilation failed in
1 files.\r\n',
      open: '',
      subtitle: '' }

It looks like it should be showing an icon but doesn't.

I guess the error should have a default priority of 10 set on line 10 of report.js.

Not sure about the icon not working on an error as it's obviously being passed the option correctly.

This is using Snarl on Windows btw.