diff options
author | xue <> | 2007-03-02 21:05:38 +0000 |
---|---|---|
committer | xue <> | 2007-03-02 21:05:38 +0000 |
commit | 13495b462f6a618530f0f6af71fb6fad6bafed91 (patch) | |
tree | ebe213dc568f858d16c48403948227c7e0932592 /framework/Web | |
parent | 56df1d34bd381e864f613cc3b72fb886dc548008 (diff) |
Improved error display.
Diffstat (limited to 'framework/Web')
-rw-r--r-- | framework/Web/Services/TPageService.php | 2 | ||||
-rw-r--r-- | framework/Web/UI/TTemplateManager.php | 14 |
2 files changed, 10 insertions, 6 deletions
diff --git a/framework/Web/Services/TPageService.php b/framework/Web/Services/TPageService.php index a0c4b8fb..7d434523 100644 --- a/framework/Web/Services/TPageService.php +++ b/framework/Web/Services/TPageService.php @@ -397,7 +397,7 @@ class TPageService extends TService */
protected function createPage($pagePath)
{
- $path=$this->getBasePath().'/'.strtr($pagePath,'.','/');
+ $path=$this->getBasePath().DIRECTORY_SEPARATOR.strtr($pagePath,'.','/');
$hasTemplateFile=is_file($path.self::PAGE_FILE_EXT);
$hasClassFile=is_file($path.Prado::CLASS_FILE_EXT);
diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index b94becb1..a8caba24 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -65,7 +65,7 @@ class TTemplateManager extends TModule public function getTemplateByClassName($className)
{
$class=new ReflectionClass($className);
- $tplFile=dirname($class->getFileName()).'/'.$className.self::TEMPLATE_FILE_EXT;
+ $tplFile=dirname($class->getFileName()).DIRECTORY_SEPARATOR.$className.self::TEMPLATE_FILE_EXT;
return $this->getTemplateByFileName($tplFile);
}
@@ -752,7 +752,7 @@ class TTemplate extends TApplicationComponent implements ITemplate }
catch(Exception $e)
{
- if(($e instanceof TException) && ($e->getErrorCode()==='template_format_invalid' || $e->getErrorCode()==='template_format_invalid2'))
+ if(($e instanceof TException) && ($e instanceof TTemplateException))
throw $e;
if($matchEnd===0)
$line=$this->_startingLine+1;
@@ -992,6 +992,7 @@ class TTemplate extends TApplicationComponent implements ITemplate protected function handleException($e,$line,$input=null)
{
$srcFile=$this->_tplFile;
+
if(($n=count($this->_includedFiles))>0) // need to adjust error row number and file name
{
for($i=$n-1;$i>=0;--$i)
@@ -1009,10 +1010,13 @@ class TTemplate extends TApplicationComponent implements ITemplate }
}
}
- if(empty($srcFile))
- throw new TConfigurationException('template_format_invalid2',$line,$e->getMessage(),$input);
+ $exception=new TTemplateException('template_format_invalid',$e->getMessage());
+ $exception->setLineNumber($line);
+ if(!empty($srcFile))
+ $exception->setTemplateFile($srcFile);
else
- throw new TConfigurationException('template_format_invalid',$srcFile,$line,$e->getMessage());
+ $exception->setTemplateSource($input);
+ throw $exception;
}
/**
|