mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-13 10:56:38 +00:00
add methods and fix naming of methods in Twig_Error
This commit is contained in:
committed by
Fabien Potencier
parent
c20116ee8d
commit
fb4d1c2214
+24
-2
@@ -44,7 +44,7 @@ class Twig_Error extends Exception
|
||||
*
|
||||
* @return string The filename
|
||||
*/
|
||||
public function getFilename()
|
||||
public function getTemplateFile()
|
||||
{
|
||||
return $this->filename;
|
||||
}
|
||||
@@ -54,13 +54,35 @@ class Twig_Error extends Exception
|
||||
*
|
||||
* @param string $filename The filename
|
||||
*/
|
||||
public function setFilename($filename)
|
||||
public function setTemplateFile($filename)
|
||||
{
|
||||
$this->filename = $filename;
|
||||
|
||||
$this->updateRepr();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the template line where the error occurred.
|
||||
*
|
||||
* @return integer The template line
|
||||
*/
|
||||
public function getTemplateLine()
|
||||
{
|
||||
return $this->lineno;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the template line where the error occurred.
|
||||
*
|
||||
* @param integer $lineno The template line
|
||||
*/
|
||||
public function setTemplateLine($lineno)
|
||||
{
|
||||
$this->lineno = $lineno;
|
||||
|
||||
$this->updateRepr();
|
||||
}
|
||||
|
||||
protected function updateRepr()
|
||||
{
|
||||
$this->message = $this->rawMessage;
|
||||
|
||||
+2
-2
@@ -82,8 +82,8 @@ class Twig_Parser implements Twig_ParserInterface
|
||||
$this->checkBodyNodes($body);
|
||||
}
|
||||
} catch (Twig_Error_Syntax $e) {
|
||||
if (null === $e->getFilename()) {
|
||||
$e->setFilename($this->stream->getFilename());
|
||||
if (null === $e->getTemplateFile()) {
|
||||
$e->setTemplateFile($this->stream->getFilename());
|
||||
}
|
||||
|
||||
throw $e;
|
||||
|
||||
Reference in New Issue
Block a user