summaryrefslogtreecommitdiff
path: root/tko/parsers/version_0.py
diff options
context:
space:
mode:
authorlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-03-02 19:34:05 +0000
committerlmr <lmr@592f7852-d20e-0410-864c-8624ca9c26a4>2011-03-02 19:34:05 +0000
commit95395da47bd9f83ae7a1acc901bb0bbd9c59acd0 (patch)
treedf88a116bacefeb0980d42f5080a7d1d4d65f729 /tko/parsers/version_0.py
parent8da38b27745c1062abef90ac89c8ce0d54910918 (diff)
Results parser: Handle errors parsing lines more properly
Use a better error message to help debug what is going on. I don't see how that regex could fail off the top of my head, even an empty string should match and return '' and '' for the groups. (update: What we're seeing after this is that somehow the parser is getting a "line" that contains newlines at times; not sure how) Signed-off-by: Gregory Smith <gps@google.com> git-svn-id: svn://test.kernel.org/autotest/trunk@5274 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/parsers/version_0.py')
-rw-r--r--tko/parsers/version_0.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/tko/parsers/version_0.py b/tko/parsers/version_0.py
index 7e8a5d88..c690d211 100644
--- a/tko/parsers/version_0.py
+++ b/tko/parsers/version_0.py
@@ -251,7 +251,13 @@ class status_line(object):
def parse_line(cls, line):
if not status_line.is_status_line(line):
return None
- indent, line = re.search(r"^(\t*)(.*)$", line).groups()
+ match = re.search(r"^(\t*)(.*)$", line)
+ if not match:
+ # A more useful error message than:
+ # AttributeError: 'NoneType' object has no attribute 'groups'
+ # to help us debug WTF happens on occasion here.
+ raise RuntimeError("line %r could not be parsed." % line)
+ indent, line = match.groups()
indent = len(indent)
# split the line into the fixed and optional fields