diff options
Diffstat (limited to 'lib/exTpl/TemplateParserException.php')
| -rw-r--r-- | lib/exTpl/TemplateParserException.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/exTpl/TemplateParserException.php b/lib/exTpl/TemplateParserException.php new file mode 100644 index 0000000..2c7abf8 --- /dev/null +++ b/lib/exTpl/TemplateParserException.php @@ -0,0 +1,19 @@ +<?php + +namespace exTpl; + +use Exception; + +/** + * Exception class used to report template parse errors. + */ +class TemplateParserException extends Exception +{ + public function __construct(string $message, Scanner $scanner) + { + $type = $scanner->tokenType(); + $value = is_int($type) ? $scanner->tokenValue() : $type; + + return parent::__construct("$message at \"$value\""); + } +} |
