Less error not handled properly
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 12
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
In the render method:
less.render(input, lessOpts, function(err, output) {
if (err) {
self.emit('error', new Error(err.message + ': ' + err.filename + '(' + err.line + ')'));
} else {
self.queue(jsToLoad(output.css));
}
output.imports.forEach(function(f) {
self.emit('file', f);
});
self.queue(null);
});
It properly emits an error event should one occurs, however the code continues to execute resulting in another error upon output.imports.forEach(...) due to output being null. A simple output && output.import... should fix this issue.
Currently we are using this plugin with browserify and gulp. In the case of a less compilation error, the actual error is handled but the null reference error occurs outside of the event system and will result in a crash of the gulp process.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the render method and inspect the less.render callback shown in the issue, especially the error path and subsequent import handling. Reproduce a Less compilation error through the Browserify or gulp usage, then verify the error is handled without a null-reference crash or process termination.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100