From 1c71f301ca49b287c29e7e2200f640bad1487557 Mon Sep 17 00:00:00 2001 From: Ed Morley Date: Tue, 24 Oct 2017 15:54:53 +0100 Subject: [PATCH] Bug 1326250 - Fix TypeError in PerformanceParser error logging (#2868) Previously schema violations would result in: `TypeError: not enough arguments for format string` The exception `message` property is used instead of the `str` representation, since the latter results in pages of log output rather than just the human readable message: https://github.com/Julian/jsonschema/blob/v2.6.0/jsonschema/exceptions.py#L59-L88 https://python-jsonschema.readthedocs.io/en/v2.6.0/errors/#jsonschema.exceptions.ValidationError.message --- treeherder/log_parser/parsers.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/treeherder/log_parser/parsers.py b/treeherder/log_parser/parsers.py index f885caec7..7febc0c7f 100644 --- a/treeherder/log_parser/parsers.py +++ b/treeherder/log_parser/parsers.py @@ -494,9 +494,8 @@ class PerformanceParser(ParserBase): except ValueError: logger.warning("Unable to parse Perfherder data from line: %s", line) - except jsonschema.ValidationError: + except jsonschema.ValidationError as e: logger.warning("Perfherder line '%s' does not comply with " - "json schema: %s", line) - # don't mark as complete, in case there are multiple performance - # artifacts - # self.complete = True + "json schema: %s", line, e.message) + + # Don't mark the parser as complete, in case there are multiple performance artifacts.