Twig API
Class

Twig_Error_Loader

class Twig_Error_Loader extends Twig_Error

Exception thrown when an error occurs during template loading.

Automatic template information guessing is always turned off as
if a template cannot be loaded, there is nothing to guess.
However, when a template is loaded from another one, then, we need
to find the current context and this is automatically done by
Twig_Template::displayWithErrorHandling().

This strategy makes Twig_Environment::resolveTemplate() much faster.

Methods

__construct(string $message, integer $lineno = -1, string $filename = null, Exception $previous = null)

Constructor.

string getRawMessage()

Gets the raw message.

from Twig_Error
string getTemplateFile()

Gets the filename where the error occurred.

from Twig_Error
setTemplateFile(string $filename)

Sets the filename where the error occurred.

from Twig_Error
integer getTemplateLine()

Gets the template line where the error occurred.

from Twig_Error
setTemplateLine(integer $lineno)

Sets the template line where the error occurred.

from Twig_Error
guess()

from Twig_Error
Exception __call(string $method, array $arguments)

For PHP < 5.3.0, provides access to the getPrevious() method.

from Twig_Error

Details

at line 27
public __construct(string $message, integer $lineno = -1, string $filename = null, Exception $previous = null)

Constructor.

Set both the line number and the filename to false to
disable automatic guessing of the original template name
and line number.

Set the line number to -1 to enable its automatic guessing.
Set the filename to null to enable its automatic guessing.

By default, automatic guessing is enabled.

Parameters

string $message The error message
integer $lineno The template line where the error occurred
string $filename The template file name where the error occurred
Exception $previous The previous exception

in Twig_Error at line 84
public string getRawMessage()

Gets the raw message.

Return Value

string The raw message

in Twig_Error at line 94
public string getTemplateFile()

Gets the filename where the error occurred.

Return Value

string The filename

in Twig_Error at line 104
public setTemplateFile(string $filename)

Sets the filename where the error occurred.

Parameters

string $filename The filename

in Twig_Error at line 116
public integer getTemplateLine()

Gets the template line where the error occurred.

Return Value

integer The template line

in Twig_Error at line 126
public setTemplateLine(integer $lineno)

Sets the template line where the error occurred.

Parameters

integer $lineno The template line

in Twig_Error at line 133
public guess()

in Twig_Error at line 149
public Exception __call(string $method, array $arguments)

For PHP < 5.3.0, provides access to the getPrevious() method.

Parameters

string $method The method name
array $arguments The parameters to be passed to the method

Return Value

Exception The previous exception or null

Exceptions

BadMethodCallException