https://github.com/taku-o/gulp-task-err-handler
gulp4.series, gulp4.parallel, gulp4.task error handling gulp-task.
https://github.com/taku-o/gulp-task-err-handler
error-handler gulp gulp-tasks gulp4
Last synced: 10 months ago
JSON representation
gulp4.series, gulp4.parallel, gulp4.task error handling gulp-task.
- Host: GitHub
- URL: https://github.com/taku-o/gulp-task-err-handler
- Owner: taku-o
- Created: 2019-06-28T00:51:01.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-03T15:54:12.000Z (about 3 years ago)
- Last Synced: 2025-04-01T22:40:49.063Z (10 months ago)
- Topics: error-handler, gulp, gulp-tasks, gulp4
- Language: JavaScript
- Homepage:
- Size: 516 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# gulp-task-err-handler
## description
gulp4.series, gulp4.parallel, gulp4.task error handling gulp-task.
catching error in gulp4.series, gulp4.parallel, gulp4.task tasks,
and call error handling function.
## install
```sh
npm install --save-dev gulp-task-error-handler
```
## sample code
### handle gulp4.series error
```javascript
const gulp = require('gulp');
const handler = require('gulp-task-error-handler');
gulp.task('hello', (cb) => {
console.log('hello');
return cb();
});
gulp.task('world', (cb) => {
console.log('world');
return cb();
});
gulp.task('gulp', (cb) => {
console.log('gulp');
throw new Error('gulp error');
});
// wrapping gulp task
// if error will be thrown, error handling code is called.
gulp.task('run', handler(gulp.series('hello', 'world', 'gulp'),
(err) => {
console.log('catch error');
})
);
```
### handle gulp4.parallel, gulp4.task error
wrapping with 'gulp-task-error-handler'.
```javascript
gulp.task('run', handler(gulp.parallel('hello', 'world', 'gulp'),
(err) => {
console.log('catch error');
})
);
```
```javascript
gulp.task('run', handler(gulp.task('gulp'),
(err) => {
console.log('catch error');
})
);
```
## replace gulp3 "run-sequence" with "gulp-task-error-handler".
- gulp3 run-sequence
```javascript
const gulp = require('gulp');
const runSequence = require('run-sequence');
gulp.task('package', (cb) => {
runSequence('tsc-debug', '_rm-package', '_package-debug', '_unpacked', '_notify', '_kill', (err) => {
if (err) {
gulp.start('_notifyError');
}
cb(err);
});
});
```
- replace with "gulp-task-error-handler" sample.
```javascript
const gulp = require('gulp');
const handler = require('gulp-task-error-handler');
gulp.task('package',
handler(gulp.series('tsc-debug', '_rm-package', '_package-debug', '_unpacked', '_notify', '_kill'), (err) => {
gulp.task('_notifyError')();
})
);
```