Exception.php
3.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
<?php
/**
* PHPTAL templating engine
*
* PHP Version 5
*
* @category HTML
* @package PHPTAL
* @author Laurent Bedubourg <lbedubourg@motion-twin.com>
* @author Kornel Lesiński <kornel@aardvarkmedia.co.uk>
* @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License
* @version SVN: $Id: Exception.php 746 2009-10-05 14:21:40Z kornel $
* @link http://phptal.org/
*/
/**
* @package PHPTAL
* @subpackage Exception
*/
class PHPTAL_Exception extends Exception
{
}
/**
* Exception that is related to location within a template.
* You can check srcFile and srcLine to find source of the error.
*
* @package PHPTAL
* @subpackage Exception
*/
class PHPTAL_TemplateException extends PHPTAL_Exception
{
public $srcFile;
public $srcLine;
public function __construct($msg, $srcFile=false, $srcLine=false)
{
parent::__construct($msg);
$this->srcFile = $srcFile;
$this->srcLine = $srcLine;
if ($srcFile) {
$this->file = $srcFile;
$this->line = (int)$srcLine;
}
}
public function __toString()
{
if (!$this->srcFile) return parent::__toString();
return "From {$this->srcFile} around line {$this->srcLine}\n".parent::__toString();
}
/**
* set new source line/file only if one hasn't been set previously
*/
public function hintSrcPosition($srcFile, $srcLine)
{
if ($srcFile && !$this->srcFile) {
$this->srcFile = $srcFile; $this->srcLine = $srcLine;
} elseif ($srcLine && $this->srcFile === $srcFile && !$this->srcLine) {
$this->srcLine = $srcLine;
}
$this->file = $this->srcFile;
$this->line = $this->srcLine;
}
}
/**
* PHPTAL failed to load template
*
* @package PHPTAL
* @subpackage Exception
*/
class PHPTAL_IOException extends PHPTAL_Exception
{
}
/**
* Parse error in TALES expression.
*
* @package PHPTAL
* @subpackage Exception
*/
class PHPTAL_InvalidVariableNameException extends PHPTAL_Exception
{
}
/**
* You're probably not using PHPTAL class properly
*
* @package PHPTAL
* @subpackage Exception
*/
class PHPTAL_ConfigurationException extends PHPTAL_Exception
{
}
/**
* Runtime error in TALES expression
*
* @package PHPTAL
* @subpackage Exception
*/
class PHPTAL_VariableNotFoundException extends PHPTAL_TemplateException
{
}
/**
* XML well-formedness errors and alike.
*
* @package PHPTAL
* @subpackage Exception
*/
class PHPTAL_ParserException extends PHPTAL_TemplateException
{
}
/**
* ${unknown:foo} found in template
*
* @package PHPTAL
* @subpackage Exception
*/
class PHPTAL_UnknownModifierException extends PHPTAL_TemplateException
{
private $modifier_name;
public function __construct($msg, $modifier_name = NULL)
{
$this->modifier_name = $modifier_name;
parent::__construct($msg);
}
public function getModifierName()
{
return $this->modifier_name;
}
}
/**
* Wrong macro name in metal:use-macro
*
* @package PHPTAL
* @subpackage Exception
*/
class PHPTAL_MacroMissingException extends PHPTAL_TemplateException
{
}
?>