Browse Source

Improve error messages

pull/218/head
Oliverpool 9 years ago
parent
commit
346f630bba
  1. 12
      patacrep/songs/chordpro/syntax.py

12
patacrep/songs/chordpro/syntax.py

@ -144,10 +144,16 @@ class ChordproParser(Parser):
if match is not None: if match is not None:
yield (prefix, match.groupdict()['value'], "") yield (prefix, match.groupdict()['value'], "")
continue continue
else:
self.error(
line=lineno,
message="Image: Unknown argument name '{}'.".format(prefix),
)
continue
self.error( self.error(
line=lineno, line=lineno,
message="Image: Ignoring unparsable argument '{}'.".format(item), message="Image: Unsupported {} value: '{}'.".format(prefix, suffix),
) )
def _iter_image_size_arguments(self, argument, *, lineno): def _iter_image_size_arguments(self, argument, *, lineno):
arguments = set() arguments = set()
@ -155,7 +161,7 @@ class ChordproParser(Parser):
if name in arguments: if name in arguments:
self.error( self.error(
line=lineno, line=lineno,
message="Image: Ignoring extra {} argument.".format(name), message="Image: Ignoring repeated argument: {}.".format(name),
) )
continue continue
if ( if (

Loading…
Cancel
Save