Skip to content

Commit 466a83b

Browse files
committed
Better error message for unknown tokens
1 parent 04f598e commit 466a83b

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

adafruit_templateengine.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -521,12 +521,10 @@ def _create_template_function( # pylint: disable=,too-many-locals,too-many-bran
521521
nested_autoescape_modes.pop()
522522

523523
else:
524-
raise ValueError(
525-
f"Unknown token type: {token} at {token_match.start()}"
526-
)
524+
raise SyntaxError(f"Unknown token type: {token}")
527525

528526
else:
529-
raise ValueError(f"Unknown token type: {token} at {token_match.start()}")
527+
raise SyntaxError(f"Unknown token type: {token}")
530528

531529
# Continue with the rest of the template
532530
template = template[token_match.end() :]

0 commit comments

Comments
 (0)