Prado\Web\UI\TTemplate::handleException PHP Method

handleException() protected method

This method rethrows the exception caught during template parsing. It adjusts the error location by giving out correct error line number and source file.
protected handleException ( $e, $line, $input = null )
    protected function handleException($e, $line, $input = null)
    {
        $srcFile = $this->_tplFile;
        if (($n = count($this->_includedFiles)) > 0) {
            for ($i = $n - 1; $i >= 0; --$i) {
                if ($this->_includeAtLine[$i] <= $line) {
                    if ($line < $this->_includeAtLine[$i] + $this->_includeLines[$i]) {
                        $line = $line - $this->_includeAtLine[$i] + 1;
                        $srcFile = $this->_includedFiles[$i];
                        break;
                    } else {
                        $line = $line - $this->_includeLines[$i] + 1;
                    }
                }
            }
        }
        $exception = new TTemplateException('template_format_invalid', $e->getMessage());
        $exception->setLineNumber($line);
        if (!empty($srcFile)) {
            $exception->setTemplateFile($srcFile);
        } else {
            $exception->setTemplateSource($input);
        }
        throw $exception;
    }