Skip to content

Commit 323ce45

Browse files
committed
Better parser error messages
1 parent b0efe93 commit 323ce45

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## (Unreleased) ##
22

33
* Allows the user to specify ignored properties and selectors
4+
* Better parse error messages
45

56
## 0.2.1 - 3/28/2013 ##
67

lib/csscss/cli.rb

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,13 @@ def execute
6565
end
6666

6767
rescue Parslet::ParseFailed => e
68-
puts "Had a problem parsing the css"
69-
puts e.cause.ascii_tree
68+
line, column = e.cause.source.line_and_column
69+
puts "Had a problem parsing the css at line: #{line}, column: #{column}".red
70+
if ENV['CSSCSS_DEBUG'] == 'true'
71+
puts e.cause.ascii_tree.red
72+
else
73+
puts "Run with CSSCSS_DEBUG=true for verbose parser errors".red
74+
end
7075
exit 1
7176
end
7277

0 commit comments

Comments
 (0)