Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-error-handle

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-error-handle

Allows you to set one error handler for multiple pipes

  • 1.0.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
1.3K
increased by7.18%
Maintainers
1
Weekly downloads
 
Created
Source

Allows you to set single handler instead of appending .on('error', log) to each pipe.
In contrary to gulp-plumber if error occures task will stop, it is, though do not means that your watch task will stop (see example).

How to use

const errorHandler = require('gulp-error-handle');

gulp.task('build', function() {
  return gulp.src('styles/*.css')
    .pipe(errorHandler())
    .pipe(gulp.dest('build/'));
});

you can pass in function as well

const logError = function(err) {
  gutil.log(err);
  this.emit('end');
};

gulp.task('build', function() {
  return gulp.src('styles/*.css')
    .pipe(errorHandler(logError))
    .pipe(gulp.dest('build/'));
});

Note: if you're passing your own function in, you need to emit 'end' manually (if you're using plugin which already doing this, such as gulp-notify, you dont need to do this).

Example

const gulp = require('gulp');
const sass = require('gulp-sass');
const del = require('del');
const errorHandler = require('gulp-error-handle');

gulp.task('clean', () => del['build']);

gulp.task('css:build', ['clean'], function() {
  return gulp.src('styles/**/*.scss')
    .pipe(errorHandler())
    .pipe(sass())
    .pipe(gulp.dest('build/'));
});

gulp.task('watch', () => {
  gulp.watch('styles/**/*.scss', ['css:build']);
});

gulp.task('default', ['clean', 'css:build', 'watch'])

Keywords

FAQs

Package last updated on 04 Apr 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc