--- a/lib/tree_parse.py Sat Feb 07 02:46:58 2009 +0200
+++ b/lib/tree_parse.py Sat Feb 07 02:51:36 2009 +0200
@@ -5,6 +5,13 @@
A file consists of a number of lines, and each line consists of indenting whitespace and data. Each line has a parent
"""
+class TreeParseError (Exception) :
+ """
+ Error parsing a tree file
+ """
+
+ pass
+
def _read_lines (path, stop_tokens='') :
"""
Reads lines from the given path, ignoring empty lines, and yielding (line_number, indent, line) tuples, where
@@ -109,7 +116,7 @@
break
elif stack_indent < indent :
- assert False, "Bad un-indent"
+ raise TreeParseError("Bad unindent on %s:%d, %d < %d" % (path, line_number, stack_indent, indent))
# add to parent?
if parent :