Class that raises a `TemplateSyntaxError` if called. Used by the `Lexer` to specify known errors.
| 250 | |
| 251 | |
| 252 | class Failure: |
| 253 | """Class that raises a `TemplateSyntaxError` if called. |
| 254 | Used by the `Lexer` to specify known errors. |
| 255 | """ |
| 256 | |
| 257 | def __init__( |
| 258 | self, message: str, cls: t.Type[TemplateSyntaxError] = TemplateSyntaxError |
| 259 | ) -> None: |
| 260 | self.message = message |
| 261 | self.error_class = cls |
| 262 | |
| 263 | def __call__(self, lineno: int, filename: str) -> "te.NoReturn": |
| 264 | raise self.error_class(self.message, lineno, filename) |
| 265 | |
| 266 | |
| 267 | class Token(t.NamedTuple): |