$try, 'catch' => $catch], [], $lineno, $tag); } /** * Compiles the node to PHP. * * @param Compiler $compiler A Twig_Compiler instance * @throws \LogicException */ public function compile(Compiler $compiler) { $compiler->addDebugInfo($this); $compiler ->write('try {') ; $compiler ->indent() ->subcompile($this->getNode('try')) ; if ($this->hasNode('catch') && null !== $this->getNode('catch')) { $compiler ->outdent() ->write('} catch (\Exception $e) {' . "\n") ->indent() ->write('if (isset($context[\'grav\'][\'debugger\'])) $context[\'grav\'][\'debugger\']->addException($e);' . "\n") ->write('$context[\'e\'] = $e;' . "\n") ->subcompile($this->getNode('catch')) ; } $compiler ->outdent() ->write("}\n"); } }