diff options
author | xue <> | 2005-11-17 19:21:21 +0000 |
---|---|---|
committer | xue <> | 2005-11-17 19:21:21 +0000 |
commit | d833d2766f28f927cb4e1e8e660771361abdfdf9 (patch) | |
tree | f64d674c8e1ce25bdb712efb64fdf5557db9e550 /framework/Exceptions | |
parent | aa2edcf52ee7438876d826283274bf7e271fad4a (diff) |
added application mode support.
Diffstat (limited to 'framework/Exceptions')
-rw-r--r-- | framework/Exceptions/TErrorHandler.php | 24 | ||||
-rw-r--r-- | framework/Exceptions/error.en | 9 |
2 files changed, 25 insertions, 8 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];
diff --git a/framework/Exceptions/error.en b/framework/Exceptions/error.en index 146ed2e8..1d76c7f2 100644 --- a/framework/Exceptions/error.en +++ b/framework/Exceptions/error.en @@ -8,7 +8,7 @@ h2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } h3 {font-family:"Verdana";font-weight:bold;font-size:11pt}
p {font-family:"Verdana";font-weight:normal;color:black;font-size:9pt;margin-top: -5px}
code,pre {font-family:"Lucida Console";}
-.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
+td,.version {color: gray;font-size:8pt;border-top:1px solid #aaaaaa;}
.source {font-family:"Lucida Console";font-weight:normal;background-color:#ffffee;}
</style>
</head>
@@ -16,7 +16,7 @@ code,pre {font-family:"Lucida Console";} <body bgcolor="white">
<h1>%%ErrorType%%</h1>
<h3>Description</h3>
-<p>%%ErrorMessage%%</p>
+<p style="color:maroon">%%ErrorMessage%%</p>
<p>
<h3>Source File</h3>
<p>%%SourceFile%%</p>
@@ -29,6 +29,9 @@ code,pre {font-family:"Lucida Console";} %%StackTrace%%
</pre></code>
</div>
-<div class="version">%%Version%%</div>
+<div class="version">
+%%Version%%<br/>
+%%Time%%
+</div>
</body>
</html>
\ No newline at end of file |