babel / babel/gulp-babel

Implement a better error handler

Open
#121 5 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.3k
Forks
113
PR merge metrics
No merged PRs in 30d

Description

I wanted to make a gulp watch task, but every time it stopped when an error were found.
Since I've searched but found no real workaround, the only solution I found was to handle the error like `gulp-sass` does. It does not interrupt the watch and just report it on the console.

Solution source: https://github.com/dlmanning/gulp-sass/blob/master/index.js#L178

An easy implementation for whoever has problem with it is:
```js
const babel = require('gulp-babel');

babel.logError = function logError(error) {
gutil.log(error.toString(), '\n\b', error.codeFrame);
this.emit('end');
};

// how to use
babel({...})
.on('error', babel.logError)
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing the gulp-babel error flow and the gulp-sass implementation linked in the issue, then compare it with the shown babel.logError usage. The work is done when a Babel error is reported with its code frame and a gulp watch task continues running instead of stopping.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.