I am creating a gulp task that may crash under certain circumstances.
gulp.task('favicon', function () { try { require('child_process').execSync('icotool --version'); } catch( e ) { var err = new Error( 'Unix bash and icotool required for generating favicon' ); throw err; } return gulp.src('', {read: false}) .pipe(shell([ './generate-favicon.sh' ])); });
When I perform my task with gulp and run the error, the error will appear pretty ugly. I would like to present the error in the way it is done, for example, jslint gulp -util PluginError .
It actually works by simply throwing a PluginError there and throwing it, but that doesn't seem completely correct. Another solution not so pleasant would be to establish
err.showStack = false;
at least to get a lighter mistake. A gulp.task.Error will be enjoyable.
javascript error-handling gulp
Daniel AR Werner
source share