protected function Twig_Template::displayWithErrorHandling

1 call to Twig_Template::displayWithErrorHandling()
Twig_Template::display in drupal/core/vendor/twig/twig/lib/Twig/Template.php
Displays the template with the given context.

File

drupal/core/vendor/twig/twig/lib/Twig/Template.php, line 261

Class

Twig_Template
Default base class for compiled templates.

Code

protected function displayWithErrorHandling(array $context, array $blocks = array()) {
  try {
    $this
      ->doDisplay($context, $blocks);
  } catch (Twig_Error $e) {
    if (!$e
      ->getTemplateFile()) {
      $e
        ->setTemplateFile($this
        ->getTemplateName());
    }

    // this is mostly useful for Twig_Error_Loader exceptions
    // see Twig_Error_Loader
    if (false === $e
      ->getTemplateLine()) {
      $e
        ->setTemplateLine(-1);
      $e
        ->guess();
    }
    throw $e;
  } catch (Exception $e) {
    throw new Twig_Error_Runtime(sprintf('An exception has been thrown during the rendering of a template ("%s").', $e
      ->getMessage()), -1, null, $e);
  }
}