TTemplateException represents an exception caused by invalid template syntax.
С версии: 3.1
Автор: Qiang Xue (qiang.xue@gmail.com)
Наследование: extends TConfigurationException
Пример #1
0
 /**
  * Handles template parsing exception.
  * This method rethrows the exception caught during template parsing.
  * It adjusts the error location by giving out correct error line number and source file.
  * @param Exception template exception
  * @param int line number
  * @param string template string if no source file is used
  */
 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;
 }