Replace assert with a proper error

This commit is contained in:
Antoine Pitrou 2014-01-14 21:02:43 +01:00
parent f5207e617b
commit d7fb7919e3

View File

@ -2343,9 +2343,11 @@ class DSLParser:
fail("Badly-formed annotation for " + full_name + ": " + returns)
try:
name, legacy, kwargs = self.parse_converter(module.body[0].returns)
assert not legacy
if legacy:
fail("Legacy converter {!r} not allowed as a return converter"
.format(name))
if name not in return_converters:
fail("Error: No available return converter called " + repr(name))
fail("No available return converter called " + repr(name))
return_converter = return_converters[name](**kwargs)
except ValueError:
fail("Badly-formed annotation for " + full_name + ": " + returns)