From 346f630bba0cfe80b9b4c38df6001ba9dd7e5b23 Mon Sep 17 00:00:00 2001 From: Oliverpool Date: Mon, 9 May 2016 22:52:48 +0200 Subject: [PATCH] Improve error messages --- patacrep/songs/chordpro/syntax.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/patacrep/songs/chordpro/syntax.py b/patacrep/songs/chordpro/syntax.py index e300d227..ca03d271 100644 --- a/patacrep/songs/chordpro/syntax.py +++ b/patacrep/songs/chordpro/syntax.py @@ -144,10 +144,16 @@ class ChordproParser(Parser): if match is not None: yield (prefix, match.groupdict()['value'], "") continue + else: + self.error( + line=lineno, + message="Image: Unknown argument name '{}'.".format(prefix), + ) + continue self.error( line=lineno, - message="Image: Ignoring unparsable argument '{}'.".format(item), - ) + message="Image: Unsupported {} value: '{}'.".format(prefix, suffix), + ) def _iter_image_size_arguments(self, argument, *, lineno): arguments = set() @@ -155,7 +161,7 @@ class ChordproParser(Parser): if name in arguments: self.error( line=lineno, - message="Image: Ignoring extra {} argument.".format(name), + message="Image: Ignoring repeated argument: {}.".format(name), ) continue if (