Fix report of line number and Unicode exception on redundant transformation

This commit is contained in:
Ilya Zverev 2015-09-21 20:12:11 +03:00
parent 90cf99b78c
commit e48402d7a5

View file

@ -318,6 +318,8 @@ class MapCSS():
else:
raise Exception("Unexpected construction: " + css)
stck[-1][1] = css # store remained part
if not wasBroken:
stck.pop()
@ -329,7 +331,7 @@ class MapCSS():
filename = stck[-1][0] # filename
css_orig = stck[-1][2] # original
css = stck[-1][1] # remained
line = unicode(css_orig[:-len(unicode(css))]).count("\n") + 1
line = css_orig[:-len(css)].count("\n") + 1
msg = str(e) + "\nFile: " + filename + "\nLine: " + str(line)
raise Exception(msg)