Skip to content

Commit 36640c8

Browse files
committed
better error messages
1 parent 3e6e9f4 commit 36640c8

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

bin/css-coverage

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@ if (commander.css) {
5050
}
5151

5252
var CSS_STR = fs.readFileSync(commander.css, 'utf8');
53-
var ast = cssTree.parse(CSS_STR, { filename: commander.css, positions: true });
53+
var ast;
54+
try {
55+
ast = cssTree.parse(CSS_STR, { filename: commander.css, positions: true });
56+
} catch (e) {
57+
// CssSyntaxError
58+
console.error('CssSyntaxError: ' + e.message + ' @ ' + e.line + ':' + e.column);
59+
throw e;
60+
}
5461

5562
var cssForPhantom = [];
5663
cssTree.walkRules(ast, (rule) => {

0 commit comments

Comments
 (0)