dstokes / dstokes/lessify

Less error not handled properly

Open
#10 0 comments 0 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.