Skip to content

Fix double handling of exceptions#2312

Merged
lukeapage merged 1 commit intoless:masterfrom
ForbesLindesay:fix-double-exception-handling
Nov 26, 2014
Merged

Fix double handling of exceptions#2312
lukeapage merged 1 commit intoless:masterfrom
ForbesLindesay:fix-double-exception-handling

Conversation

@ForbesLindesay
Copy link
Copy Markdown
Contributor

This only effects the callback based code path. Consider code like:

less.render(str, options, function (err, res) {
  if (err) {
    console.log('error handler');
    return;
  }
  throw new Error('Ooops, I made a mistake');
});

In the case where less rendering succeeds. This should crash with the error "Ooops, I made a mistake" but instead it logs "error handler" and exists cleanly. This is because the initial error is incorrectly caught by the try catch block and given back to the callback.

This pull request fixes the bug.

@lukeapage
Copy link
Copy Markdown
Member

Thanks.. will release a patch release soon.

lukeapage added a commit that referenced this pull request Nov 26, 2014
@lukeapage lukeapage merged commit 5173186 into less:master Nov 26, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants