Commit 5975aae0 authored by Robin Sonnabend's avatar Robin Sonnabend
Browse files

More human readable error messages

ref #7
parent 87af51e4
...@@ -148,7 +148,7 @@ class Content(Element): ...@@ -148,7 +148,7 @@ class Content(Element):
content = content[len(match.group()):] content = content[len(match.group()):]
break break
if not matched: if not matched:
raise ParserException("Content does not match inner!", linenumber) raise ParserException("Dies ist kein valider Tag! (mögliche Tags sind: {})", linenumber, ", ".join(Tag.KNOWN_TAGS))
return Content(children, linenumber) return Content(children, linenumber)
# v1: has problems with missing semicolons # v1: has problems with missing semicolons
...@@ -513,7 +513,7 @@ def parse(source): ...@@ -513,7 +513,7 @@ def parse(source):
if not found: if not found:
raise ParserException("No matching syntax element found!", linenumber, tree=tree) raise ParserException("No matching syntax element found!", linenumber, tree=tree)
if current is not tree: if current is not tree:
raise ParserException("Source ended within fork! (started at line {})".format(current.linenumber), linenumber=current.linenumber, tree=tree) raise ParserException("Du hast vergessen, Klammern zu schließen! (die öffnende ist in Zeile {})".format(current.linenumber), linenumber=current.linenumber, tree=tree)
return tree return tree
def main(test_file_name=None): def main(test_file_name=None):
......
...@@ -123,7 +123,7 @@ def parse_protocol_async_inner(protocol, encoded_kwargs): ...@@ -123,7 +123,7 @@ def parse_protocol_async_inner(protocol, encoded_kwargs):
if not config.PARSER_LAZY: if not config.PARSER_LAZY:
missing_fields = [field for field in required_fields if field not in remarks] missing_fields = [field for field in required_fields if field not in remarks]
if len(missing_fields) > 0: if len(missing_fields) > 0:
error = protocol.create_error("Parsing", "Missing fields", ", ".join(missing_fields)) error = protocol.create_error("Parsing", "Du hast vergessen, Metadaten anzugeben.", ", ".join(missing_fields))
db.session.add(error) db.session.add(error)
db.session.commit() db.session.commit()
return return
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment