brunch / less-brunch

Adds LESS support to Brunch
14 stars 18 forks source link

Handle exceptions thrown by the less parser #3

Closed mlamby closed 12 years ago

mlamby commented 12 years ago

The less parser will throw exceptions if the code contains a compile error. For example:

#header {color: @color;}

This will throw the exception variable @color is undefined. The less-brunch plugin currently does not catch this and will therefore cause the 'brunch watch' process to exit with the message:

test/node_modules/less-brunch/node_modules/less/lib/less/parser.js:385
                    throw new(LessError)(e, env);
                          ^
[object Object]

This pull request adds an exception handler that formats the less exception into an error string to be passed to the callback. The 'brunch watch' command will now display the following:

15 Apr 13:29:20 - error: LESSCompiler failed in 'style.less' -- NameError:variable @color is undefined in 'style.less:1:16'
paulmillr commented 12 years ago

Great, thanks, merged.

mlamby commented 12 years ago

No worries. Thanks.