From 217565ef4eaecddcae90bd554add8fb668050fda Mon Sep 17 00:00:00 2001 From: Paul Elliott Date: Tue, 9 Mar 2021 10:24:55 +0000 Subject: [PATCH] Improve error message Make sure line number reported is correct for the overly long line, and change the message to be more readable. Signed-off-by: Paul Elliott --- scripts/assemble_changelog.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/assemble_changelog.py b/scripts/assemble_changelog.py index f85392c53..96d2217a9 100755 --- a/scripts/assemble_changelog.py +++ b/scripts/assemble_changelog.py @@ -246,12 +246,14 @@ class ChangeLog: category.name.decode('utf8')) body_split = category.body.splitlines() + line_number = 1 for line in body_split: if len(line) > MAX_LINE_LENGTH: raise InputFormatError(filename, - line_offset + category.title_line, - 'Category body line too long: "{} ({})"', - category.name.decode('utf8'), len(line)) + line_offset + category.title_line + line_number, + 'Line is longer than allowed: Length {} (Max {})', + len(line), MAX_LINE_LENGTH) + line_number += 1 self.categories[category.name] += category.body