protected function handleTwigError(Error $ex)
    {
        $context = $ex->getSourceContext();

        if (null === $context) {
            throw $ex;
        }

        $templateFile = $context->getPath();
        $templateLine = $ex->getTemplateLine();

        if ($templateFile && file_exists($templateFile)) {
            $file = $templateFile;
        } elseif ($templateFile) {
            // Attempt to locate full path to file
            try {
                $file = $this->loader->findTemplate($templateFile);
            } catch (LoaderError $exception) {
                // Unable to load template
            }
        }

        if (isset($file)) {
            $ex = new ErrorException($ex->getMessage(), 0, 1, $file, $templateLine, $ex);
        }

        throw $ex;
    }
protected function handleTwigError(Error $ex)
    {
        $context = $ex->getSourceContext();

        if (null === $context) {
            throw $ex;
        }

        $templateFile = $context->getPath();
        $templateLine = $ex->getTemplateLine();

        if ($templateFile && file_exists($templateFile)) {
            $file = $templateFile;
        } elseif ($templateFile) {
            // Attempt to locate full path to file
            try {
                $file = $this->loader->findTemplate($templateFile);
            } catch (LoaderError $exception) {
                // Unable to load template
            }
        }

        if (isset($file)) {
            $ex = new ErrorException($ex->getMessage(), 0, 1, $file, $templateLine, $ex);
        }

        throw $ex;
    }
protected function handleTwigError ( Error $ ex ) { $ context = $ ex -> getSourceContext ( ) ; if ( null === $ context ) { throw $ ex ; } $ templateFile = $ context -> getPath ( ) ; $ templateLine = $ ex -> getTemplateLine ( ) ; if ( $ templateFile && file_exists ( $ templateFile ) ) { $ file = $ templateFile ; } elseif ( $ templateFile ) { // Attempt to locate full path to file try { $ file = $ this -> loader -> findTemplate ( $ templateFile ) ; } catch ( LoaderError $ exception ) { // Unable to load template } } if ( isset ( $ file ) ) { $ ex = new ErrorException ( $ ex -> getMessage ( ) , 0 , 1 , $ file , $ templateLine , $ ex ) ; } throw $ ex ; }
Handle a TwigError exception.

@param Error $ex

@throws Error|\ErrorException
Handle a TwigError exception .