summaryrefslogtreecommitdiff
path: root/framework/Exceptions/TErrorHandler.php
diff options
context:
space:
mode:
authorxue <>2005-11-17 19:21:21 +0000
committerxue <>2005-11-17 19:21:21 +0000
commitd833d2766f28f927cb4e1e8e660771361abdfdf9 (patch)
treef64d674c8e1ce25bdb712efb64fdf5557db9e550 /framework/Exceptions/TErrorHandler.php
parentaa2edcf52ee7438876d826283274bf7e271fad4a (diff)
added application mode support.
Diffstat (limited to 'framework/Exceptions/TErrorHandler.php')
-rw-r--r--framework/Exceptions/TErrorHandler.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/framework/Exceptions/TErrorHandler.php b/framework/Exceptions/TErrorHandler.php
index 47feb54c..af41e056 100644
--- a/framework/Exceptions/TErrorHandler.php
+++ b/framework/Exceptions/TErrorHandler.php
@@ -39,11 +39,23 @@ class TErrorHandler extends TComponent implements IModule
public function handleError($sender,$param)
{
- $type='Unhandled Exception';
- $this->displayException($param,$type);
+ if(($response=Prado::getApplication()->getResponse())!==null)
+ $response->clear();
+ switch(Prado::getApplication()->getMode())
+ {
+ case 'Off':
+ case 'Debug':
+ $this->displayException($param);
+ exit(1);
+ case 'Normal':
+ case 'Performance':
+ error_log($param->__toString());
+ header("HTTP/1.0 500 Internal Error");
+ exit(1);
+ }
}
- protected function displayException($exception,$type)
+ protected function displayException($exception)
{
$lines=file($exception->getFile());
$errorLine=$exception->getLine();
@@ -66,7 +78,8 @@ class TErrorHandler extends TComponent implements IModule
'%%SourceFile%%',
'%%SourceCode%%',
'%%StackTrace%%',
- '%%Version%%'
+ '%%Version%%',
+ '%%Time%%'
);
$values=array(
get_class($exception),
@@ -74,7 +87,8 @@ class TErrorHandler extends TComponent implements IModule
htmlspecialchars($exception->getFile()).' ('.$exception->getLine().')',
$source,
htmlspecialchars($exception->getTraceAsString()),
- $_SERVER['SERVER_SOFTWARE'].' <a href="http://www.pradosoft.com/">PRADO</a>/'.Prado::getVersion()
+ $_SERVER['SERVER_SOFTWARE'].' <a href="http://www.pradosoft.com/">PRADO</a>/'.Prado::getVersion(),
+ strftime('%Y-%m-%d %H:%m',time())
);
$languages=Prado::getUserLanguages();
$errorFile=dirname(__FILE__).'/error.'.$languages[0];