-
Notifications
You must be signed in to change notification settings - Fork 8
Avoid empty error messages #6
Avoid empty error messages #6
Conversation
@@ -91,7 +91,7 @@ function psc(opts) { | |||
gutil.log('Stderr from \'' + gutil.colors.cyan('psc') + '\'\n' + gutil.colors.magenta(stderr)); | |||
}); | |||
cmd.on('close', function(code){ | |||
if (!!code) that.emit('error', new gutil.PluginError(PLUGIN, buffer.toString())); | |||
if (!!code) that.emit('error', new gutil.PluginError(PLUGIN, "psc has failed")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it worth doing these as buffer.toString() || "psc has failed"
? Or is the buffer always empty in this case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my experience it is always empty, but I'm certainly not opposed to showing it if there's ever something there.
Errors during compilation are now captured on stderr instead of stdout. This resolves issue #6, where gulp-util was throwing an exception due to a missing error message.
@pelotom, can you please try out version 0.0.9? I think the issue was that the plugin needed to capture the buffer on |
That works great, but shouldn't |
Great, glad it works! Regarding |
I think still collecting the stderr output and logging that when an error happens is better behavior. For one thing, stderr gets interleaved nondeterministically with other gulp output, so you get stuff like this:
That's from before your fix to
Much nicer. |
That's a good point. I think it makes sense to collect Thanks! |
This fixes a problem where
psc
anddocgen
throw errors while throwing errors. That is, if a compilation error occurs duringpsc
for example, we emit an error usingnew gutil.PluginError(PLUGIN, buffer.toString())
, butbuffer.toString()
is null, so we get this error:which can't be handled and causes gulp to exit. This is especially annoying when trying to use
gulp watch
.The fix makes
psc
anddocgen
do the same thing aspscMake
; that is, give a static failure message.