Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling compile errors so it doesnt halt gulp watch tasks #28

Closed
wants to merge 3 commits into from
Closed

Handling compile errors so it doesnt halt gulp watch tasks #28

wants to merge 3 commits into from

Conversation

afreidz
Copy link

@afreidz afreidz commented Jul 23, 2014

When running gulp-handlebars in conjunction with gulp watch, errors are "thrown". This causes the gulp watch task to halt. Here the error message is logged to the console and the compiled template outputs an error message.

@lazd
Copy link
Owner

lazd commented Jul 23, 2014

This is how errors are handled in gulp. If you don't want watch to stop, add a listener to the error event. See this gulp issue for details and this docs page for a more complex use case.

This needs to be documented better in gulp itself.

@lazd lazd closed this Jul 23, 2014
@afreidz
Copy link
Author

afreidz commented Jul 23, 2014

Yes, while the error listener does not HALT gulp, it also never completes the compile. Therefore when you fix the error, the task never gets re-run. Not sure if that's as designed or not. I use a similar pattern, that you suggested, on error for another gulp module (gulp-less) and that task will log the error, but finish the task. Any insight on how this can be handled?

@lazd
Copy link
Owner

lazd commented Jul 23, 2014

Please read the issue I linked, it covers the exact problem you're mentioning. This may still be a problem with the plugin, but I'm not sure. Feel free to dig into gulp-less's internals and report back on how it handles things differently.

@mietek
Copy link

mietek commented Aug 30, 2014

The problem was actually fixed in d4aad97. Among other fixes, the key fix was emitting errors properly:

     if (file.isStream()) {
-      return this.emit('error', new gutil.PluginError('gulp-handlebars', 'Streaming not supported'));
+      this.emit('error', new gutil.PluginError(PLUGIN_NAME, 'Streaming not supported'));
+      return callback();
     }

@lazd
Copy link
Owner

lazd commented Aug 30, 2014

@mietek, thanks for following up on this. It sounds like gulp-handlebars is behaving as it should.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants