You are here

public function Twig_Error::__construct in Translation template extractor 6.3

Same name and namespace in other branches
  1. 7.3 vendor/Twig/Error.php \Twig_Error::__construct()

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:

int $lineno The template line where the error occurred:

string $filename The template file name where the error occurred:

Exception $previous The previous exception:

4 calls to Twig_Error::__construct()
Twig_Error_Loader::__construct in vendor/Twig/Error/Loader.php
Constructor.
Twig_Sandbox_SecurityNotAllowedFilterError::__construct in vendor/Twig/Sandbox/SecurityNotAllowedFilterError.php
Constructor.
Twig_Sandbox_SecurityNotAllowedFunctionError::__construct in vendor/Twig/Sandbox/SecurityNotAllowedFunctionError.php
Constructor.
Twig_Sandbox_SecurityNotAllowedTagError::__construct in vendor/Twig/Sandbox/SecurityNotAllowedTagError.php
Constructor.
4 methods override Twig_Error::__construct()
Twig_Error_Loader::__construct in vendor/Twig/Error/Loader.php
Constructor.
Twig_Sandbox_SecurityNotAllowedFilterError::__construct in vendor/Twig/Sandbox/SecurityNotAllowedFilterError.php
Constructor.
Twig_Sandbox_SecurityNotAllowedFunctionError::__construct in vendor/Twig/Sandbox/SecurityNotAllowedFunctionError.php
Constructor.
Twig_Sandbox_SecurityNotAllowedTagError::__construct in vendor/Twig/Sandbox/SecurityNotAllowedTagError.php
Constructor.

File

vendor/Twig/Error.php, line 58

Class

Twig_Error
Twig base exception.

Code

public function __construct($message, $lineno = -1, $filename = null, Exception $previous = null) {
  if (version_compare(PHP_VERSION, '5.3.0', '<')) {
    $this->previous = $previous;
    parent::__construct('');
  }
  else {
    parent::__construct('', 0, $previous);
  }
  $this->lineno = $lineno;
  $this->filename = $filename;
  if (-1 === $this->lineno || null === $this->filename) {
    $this
      ->guessTemplateInfo();
  }
  $this->rawMessage = $message;
  $this
    ->updateRepr();
}