throw a ParseError, instead of just an Error

This commit is contained in:
cloudhead 2010-02-25 22:49:52 -05:00
parent 543fb96a03
commit b60c296e6e
2 changed files with 7 additions and 3 deletions

View File

@ -150,7 +150,7 @@ less.parser = {
zone = stylize(input.slice(start, i), 'green') +
stylize(input.slice(i, end), 'yellow');
throw new(Error)("Parse Error on line " + line + ":\n" + zone);
throw { name: "ParseError", message: "Parse Error on line " + line + ":\n" + zone };
}
return tree;
},

View File

@ -11,9 +11,13 @@ var less = require('lib/less/adapters/server');
fs.readdirSync('test/less').forEach(function (file) {
toCSS('test/less/' + file, function (err, less) {
read(path.join('test/css', path.basename(file, '.less')) + '.css', function (e, css) {
sys.print(file + ": ")
sys.print("- " + file + ": ")
if (less === css) { sys.print('OK') }
else { sys.print(e || err) }
else if (err && err.name == 'ParseError') {
sys.print("!\n " + err.message);
} else {
sys.print("=/=");
}
sys.puts("");
});
});