# gulp-error-handle

> Allows you to set one error handler for multiple pipes

Latest version **1.0.1** (published 2018-04-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install gulp-error-handle
pnpm add gulp-error-handle
yarn add gulp-error-handle
bun add gulp-error-handle
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2018-04-04 |
| First published | 2017-05-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | mhmad.hamster@gmail.com |
| Maintainers | mhmadhamster |
| Keywords | gulp plugin, gulp error handling, gulp error, gulp error handler |

## Links

- npm: https://www.npmjs.com/package/gulp-error-handle
- npm.io page: https://npm.io/package/gulp-error-handle

## Dependencies (2)

- [through2](https://npm.io/package/through2.md) 2.0.3
- [fancy-log](https://npm.io/package/fancy-log.md) 1.3.2

## Alternatives

- [@sentry/react-native](https://npm.io/package/@sentry/react-native.md) — 2.6M weekly downloads
- [@ardatan/aggregate-error](https://npm.io/package/@ardatan/aggregate-error.md) — 708.1K weekly downloads
- [custom-error-generator](https://npm.io/package/custom-error-generator.md) — 2.0K weekly downloads
- [@technik-sde/prosemirror-recreate-transform](https://npm.io/package/@technik-sde/prosemirror-recreate-transform.md) — 1.5K weekly downloads
- [@suchipi/error-utils](https://npm.io/package/@suchipi/error-utils.md) — 78 weekly downloads

## Recent versions

- 1.0.1 (latest) — 2018-04-04
- 1.0.0 — 2017-05-30

## README

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
```js
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

```js
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

```js
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'])
```

---
_Source: https://npm.io/package/gulp-error-handle · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
