KXStudio Website https://kx.studio/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

67 lines
1.4KB

  1. <?php
  2. /**
  3. * Twig::Exceptions
  4. * ~~~~~~~~~~~~~~~~
  5. *
  6. * This module implements the Twig exceptions.
  7. *
  8. * :copyright: 2008 by Armin Ronacher.
  9. * :license: GNU GPL.
  10. */
  11. /**
  12. * Baseclass for all exceptions twig may throw. This is useful for
  13. * instance-checks to silence all twig errors for example.
  14. */
  15. class Twig_Exception extends Exception {}
  16. /**
  17. * This exception is raised when the template engine is unable to
  18. * parse or lex a template. Because the getFile() method and similar
  19. * methods are final we can't override them here but provide the real
  20. * filename and line number as public property.
  21. */
  22. class Twig_SyntaxError extends Twig_Exception
  23. {
  24. public $lineno;
  25. public $filename;
  26. public function __construct($message, $lineno, $filename=null)
  27. {
  28. parent::__construct($message);
  29. $this->lineno = $lineno;
  30. $this->filename = $filename;
  31. }
  32. }
  33. /**
  34. * Thrown when Twig encounters an exception at runtime in the Twig
  35. * core.
  36. */
  37. class Twig_RuntimeError extends Twig_Exception
  38. {
  39. public function __construct($message)
  40. {
  41. parent::__construct($message);
  42. }
  43. }
  44. /**
  45. * Raised if the loader is unable to find a template.
  46. */
  47. class Twig_TemplateNotFound extends Twig_Exception
  48. {
  49. public $name;
  50. public function __construct($name)
  51. {
  52. parent::__construct('Template not found: ' . $name);
  53. $this->name = $name;
  54. }
  55. }