1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6: */
7:
8: namespace Nette\Templating;
9:
10: use Nette;
11:
12:
13: /**
14: * The exception occured during template compilation.
15: *
16: * @author David Grudl
17: */
18: class FilterException extends Nette\InvalidStateException
19: {
20: /** @var string */
21: public $sourceFile;
22:
23: /** @var int */
24: public $sourceLine;
25:
26:
27: public function __construct($message, $code = 0, $sourceLine = 0)
28: {
29: $this->sourceLine = (int) $sourceLine;
30: parent::__construct($message, $code);
31: }
32:
33:
34: public function setSourceFile($file)
35: {
36: $this->sourceFile = (string) $file;
37: $this->message = rtrim($this->message, '.') . " in " . str_replace(dirname(dirname($file)), '...', $file)
38: . ($this->sourceLine ? ":$this->sourceLine" : '');
39: }
40:
41: }
42: