diff options
author | xue <> | 2005-11-18 18:52:28 +0000 |
---|---|---|
committer | xue <> | 2005-11-18 18:52:28 +0000 |
commit | 6b647694bdae2ab37246447cb965a5e7f97290ed (patch) | |
tree | 613b45d1b39c5ea643eef0a1801b8ea5dc376095 /framework/Exceptions/TException.php | |
parent | 47e6ce79dfaa25397c8d1bfec2134f17c894ed87 (diff) |
Diffstat (limited to 'framework/Exceptions/TException.php')
-rw-r--r-- | framework/Exceptions/TException.php | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/framework/Exceptions/TException.php b/framework/Exceptions/TException.php index 0bc963f8..a90c14dd 100644 --- a/framework/Exceptions/TException.php +++ b/framework/Exceptions/TException.php @@ -40,16 +40,16 @@ class TException extends Exception {
private $_errorCode='';
- public function __construct($errorCode)
+ public function __construct($errorMessage)
{
- $this->_errorCode=$errorCode;
+ $this->_errorCode=$errorMessage;
$args=func_get_args();
- $args[0]=$this->translateErrorCode($errorCode);
+ $args[0]=$this->translateErrorMessage($errorMessage);
$str=call_user_func_array('sprintf',$args);
parent::__construct($str);
}
- protected function translateErrorCode($key)
+ protected function translateErrorMessage($key)
{
$languages=Prado::getUserLanguages();
$msgFile=dirname(__FILE__).'/messages.'.$languages[0];
@@ -74,20 +74,10 @@ class TException extends Exception return $this->_errorCode;
}
- public function setErrorCode($errorCode)
- {
- $this->_errorCode=$errorCode;
- }
-
public function getErrorMessage()
{
return $this->getMessage();
}
-
- public function setErrorMessage($msg)
- {
- $this->message=$msg;
- }
}
class TSystemException extends TException
@@ -142,10 +132,6 @@ class TSecurityException extends TException {
}
-class THttpException extends TException
-{
-}
-
class TNotSupportedException extends TException
{
}
@@ -173,4 +159,23 @@ class TPhpErrorException extends TException }
}
+
+class THttpException extends TException
+{
+ private $_statusCode;
+
+ public function __construct($statusCode,$errorMessage)
+ {
+ $args=func_get_args();
+ array_shift($args);
+ call_user_func_array(array('parent', '__construct'), $args);
+ $this->_statusCode=TPropertyValue::ensureInteger($statusCode);
+ }
+
+ public function getStatusCode()
+ {
+ return $this->_statusCode;
+ }
+}
+
?>
\ No newline at end of file |