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

Add option to continue streaming on error #12

Closed
wants to merge 1 commit into from

Conversation

backflip
Copy link

Currently, the stream ends when an error occurs. This is undesirable when having a watch process running, e.g.

A solution is to use the failures option of map-stream which was added for this case: dominictarr/map-stream#7

What do you think?

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 0e7d705 on unic:master into 628b570 on shannonmoeller:master.

@shannonmoeller
Copy link
Owner

I've actually been working on replacing map-stream with through2.obj. That change plus gulp-plumber provides a Gulp 3 solution until Gulp 4 (and its improved error handling) is released.

Does that sound reasonable?

@backflip
Copy link
Author

Even better. Any helping hands appreciated/wanted? Or are you almost through with it anyway?

@backflip backflip closed this Apr 15, 2015
@shannonmoeller
Copy link
Owner

Thanks! I've got the switch to through2 made, but I want to get a fix for #15 in before release, as you'll likely need that too.

@shannonmoeller
Copy link
Owner

Released switch to through2 as v2.4.0.

@backflip backflip reopened this Apr 19, 2015
@backflip backflip closed this Apr 19, 2015
@backflip
Copy link
Author

This still crashes when throwing an error. I guess instead of calling the template function directly, it should be wrapped with a try/catch:

try {
    file.contents = new Buffer(template(context));
} catch (err) {
    this.emit('error', err);
}

@backflip backflip reopened this Apr 19, 2015
@shannonmoeller
Copy link
Owner

@backflip I'll get the error handling updated, but even so, you'll need to use gulp-plumber until Gulp 4 is released. There was a patch to make gulp.watch in Gulp 3 work a little better, but it's still broken.

var gulp = require('gulp'),
    plumber = require('gulp-plumber'),
    hb = require('gulp-hb');

gulp.task('html', function () {
    return gulp
        .src('./src/**/*.hbs')
        .pipe(plumber())
        .pipe(hb())
        .pipe(gulp.dest('./web'));
});

gulp.task('watch', function () {
    gulp.watch('./src/**/*.hbs', ['html']);
});

@shannonmoeller
Copy link
Owner

Improved error handling published as v2.4.2

@backflip
Copy link
Author

backflip commented Apr 20, 2015 via email

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