From 6b647694bdae2ab37246447cb965a5e7f97290ed Mon Sep 17 00:00:00 2001 From: xue <> Date: Fri, 18 Nov 2005 18:52:28 +0000 Subject: --- framework/Exceptions/TException.php | 41 +++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 18 deletions(-) (limited to 'framework/Exceptions/TException.php') 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 -- cgit v1.2.3