HumHub Documentation (unofficial)

Error extends Exception
in package

Twig base exception.

This exception class and its children must only be used when an error occurs during the loading of a template, when a syntax error is detected in a template, or when rendering a template. Other errors must use regular PHP exception classes (like when the template cache directory is not writable for instance).

To help debugging template issues, this class tracks the original template name and line where the error occurred.

Whenever possible, you must set these information (original template name and line number) yourself by passing them to the constructor. If some or all these information are not available from where you throw the exception, then this class will guess them automatically (when the line number is set to -1 and/or the name is set to null). As this is a costly operation, this can be disabled by passing false for both the name and the line number when creating a new instance of this class.

Tags
author

Fabien Potencier fabien@symfony.com

Table of Contents

Properties

$lineno  : mixed
$name  : mixed
$rawMessage  : mixed
$sourceCode  : mixed
$sourcePath  : mixed

Methods

__construct()  : mixed
Constructor.
appendMessage()  : void
getRawMessage()  : string
getSourceContext()  : Source|null
getTemplateLine()  : int
guess()  : void
setSourceContext()  : void
setTemplateLine()  : void
guessTemplateInfo()  : void
updateRepr()  : void

Properties

$lineno

private mixed $lineno

$rawMessage

private mixed $rawMessage

$sourceCode

private mixed $sourceCode

$sourcePath

private mixed $sourcePath

Methods

__construct()

Constructor.

public __construct(string $message[, int $lineno = -1 ][, Source|null $source = null ][, Throwable|null $previous = null ]) : mixed

By default, automatic guessing is enabled.

Parameters
$message : string

The error message

$lineno : int = -1

The template line where the error occurred

$source : Source|null = null

The source context where the error occurred

$previous : Throwable|null = null

appendMessage()

public appendMessage(mixed $rawMessage) : void
Parameters
$rawMessage : mixed

getRawMessage()

public getRawMessage() : string
Return values
string

getTemplateLine()

public getTemplateLine() : int
Return values
int

guess()

public guess() : void

setSourceContext()

public setSourceContext([Source|null $source = null ]) : void
Parameters
$source : Source|null = null

setTemplateLine()

public setTemplateLine(int $lineno) : void
Parameters
$lineno : int

guessTemplateInfo()

private guessTemplateInfo() : void

updateRepr()

private updateRepr() : void

        
On this page

Search results