當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Zend_Exception類代碼示例

本文整理匯總了PHP中Zend_Exception的典型用法代碼示例。如果您正苦於以下問題:PHP Zend_Exception類的具體用法?PHP Zend_Exception怎麽用?PHP Zend_Exception使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Zend_Exception類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testExceptions

 public function testExceptions()
 {
     // Ohne Mail
     $exception = new Kwf_Exception();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertTrue($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     // Mit Mail
     Zend_Registry::get('config')->debug->error->log = true;
     Kwf_Config::deleteValueCache('debug.error.log');
     $exception = new Kwf_Exception();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertFalse($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     // Nicht-Kwf_Exception mit Mail
     Zend_Registry::get('config')->debug->error->log = true;
     Kwf_Config::deleteValueCache('debug.error.log');
     $e = new Zend_Exception();
     $exception = new Kwf_Exception_Other($e);
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $e->getMessage());
     $this->assertFalse($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     Zend_Registry::get('config')->debug->error->log = false;
     Kwf_Config::deleteValueCache('debug.error.log');
     // Kwf_Exception_NoLog mit Debug
     Zend_Registry::get('config')->debug->error->log = true;
     Kwf_Config::deleteValueCache('debug.error.log');
     $exception = new Kwf_Exception_NoLog();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertFalse($view->debug);
     Zend_Registry::get('config')->debug->error->log = false;
     Kwf_Config::deleteValueCache('debug.error.log');
     $this->assertEquals($view->template, 'error.tpl');
     // Kwf_Exception_NoLog ohne Debug
     $exception = new Kwf_Exception_NoLog();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertTrue($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     // Kwf_Exception_NotFound
     $exception = new Kwf_Exception_NotFound();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertEquals($view->template, 'error404.tpl');
     // Nicht-Kwf_Exception
     $exception = new Exception();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertEquals($view->template, 'error.tpl');
     // ClientException
     $exception = new Kwf_ClientException();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertEquals($view->template, 'error-client.tpl');
 }
開發者ID:xiaoguizhidao,項目名稱:koala-framework,代碼行數:59,代碼來源:ExceptionTest.php

示例2: checkModifyException

 public function checkModifyException(Zend_Exception $exception)
 {
     if (preg_match('/Duplicate entry.*for key (\'name\'|2)/i', $exception->getMessage())) {
         $this->_setError('nameExists');
         return false;
     }
     return true;
 }
開發者ID:sitengine,項目名稱:sitengine,代碼行數:8,代碼來源:Table.php

示例3: testToString

 public function testToString()
 {
     $p = new Zend_Exception('p', 0);
     $e = new Zend_Exception('e', 0, $p);
     $s = $e->__toString();
     $this->assertContains('p', $s);
     $this->assertContains('Next', $s);
     $this->assertContains('e', $s);
 }
開發者ID:sasezaki,項目名稱:mirror-zf1-tests,代碼行數:9,代碼來源:ExceptionTest.php

示例4: testExceptions

 public function testExceptions()
 {
     // Ohne Mail
     $exception = new Kwf_Exception();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertTrue($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     // Mit Mail
     Kwf_Exception_Abstract::$logErrors = true;
     $exception = new Kwf_Exception();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertFalse($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     // Nicht-Kwf_Exception mit Mail
     Kwf_Exception_Abstract::$logErrors = true;
     $e = new Zend_Exception();
     $exception = new Kwf_Exception_Other($e);
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $e->getMessage());
     $this->assertFalse($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     Kwf_Exception_Abstract::$logErrors = null;
     // Kwf_Exception_NoLog mit Debug
     Kwf_Exception_Abstract::$logErrors = true;
     $exception = new Kwf_Exception_NoLog();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertFalse($view->debug);
     Kwf_Exception_Abstract::$logErrors = null;
     $this->assertEquals($view->template, 'error.tpl');
     // Kwf_Exception_NoLog ohne Debug
     $exception = new Kwf_Exception_NoLog();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertTrue($view->debug);
     $this->assertEquals($view->template, 'error.tpl');
     // Kwf_Exception_NotFound
     $exception = new Kwf_Exception_NotFound();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertEquals($view->template, 'error404.tpl');
     // Nicht-Kwf_Exception
     $exception = new Exception();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertEquals($view->template, 'error.tpl');
     // ClientException
     $exception = new Kwf_ClientException();
     $view = $this->_processException($exception);
     $this->assertEquals($view->message, $exception->getMessage());
     $this->assertEquals($view->template, 'error-client.tpl');
 }
開發者ID:koala-framework,項目名稱:koala-framework,代碼行數:54,代碼來源:ExceptionTest.php

示例5: __construct

 /**
  * Create a new ServiceException.
  *
  * @return array An array containing a collection of
  *          Zend_Gdata_Gapps_Error objects.
  */
 public function __construct($errors = null)
 {
     parent::__construct("Server errors encountered");
     if ($errors !== null) {
         $this->setErrors($errors);
     }
 }
開發者ID:ramonornela,項目名稱:Zebra,代碼行數:13,代碼來源:ServiceException.php

示例6: __construct

 public function __construct($message, $op1 = null, $op2 = null, $result = null)
 {
     $this->op1 = $op1;
     $this->op2 = $op2;
     $this->result = $result;
     parent::__construct($message);
 }
開發者ID:quangbt2005,項目名稱:vhost-kis,代碼行數:7,代碼來源:Exception.php

示例7: __construct

 public function __construct($message = 'Server Error', $code = 400, $extra = null)
 {
     switch ($code) {
         case 401:
             if (null == $message) {
                 $message = 'Not Authorised';
             }
             break;
         case 403:
             if (null == $message) {
                 $message = 'Forbidden';
             }
             break;
         case 404:
             if (null == $message) {
                 $message = 'Not Found';
             }
             break;
         case 405:
             if (null == $message) {
                 $message = 'Method Not Allowed';
             }
             Zend_Controller_Front::getInstance()->getResponse()->setHeader('Allow', $extra['allowed_methods']);
             break;
     }
     parent::__construct($message, $code);
 }
開發者ID:rdallasgray,項目名稱:bbx,代碼行數:27,代碼來源:Exception.php

示例8: __construct

 public function __construct($message = '', $code = 0, Exception $previous = null)
 {
     if (Core_Registry::getMessage()->isTranslated($message)) {
         $message = Core_Registry::getMessage()->translate($message);
     }
     parent::__construct($message, (int) $code, $previous);
 }
開發者ID:sgdoc,項目名稱:sgdoce-codigo,代碼行數:7,代碼來源:Exception.php

示例9: __construct

 /**
  *
  * @param String $msg The message
  * @param int $code the HttpResponseCode for this exception
  * @param \Exception $previous
  * @param string $info Optional extra information on the exception
  */
 public function __construct($msg = '', $code = 200, \Exception $previous = null, $info = null)
 {
     parent::__construct($msg, $code, $previous);
     if ($info) {
         $this->setInfo($info);
     }
 }
開發者ID:harmslijper,項目名稱:gemstracker-library,代碼行數:14,代碼來源:Exception.php

示例10: __construct

 /**
  *
  * @param string $msg
  * @param int $code
  * @param Exception $previous 
  */
 public function __construct($msg = '', $code = 0, Exception $previous = null)
 {
     if (is_array($msg)) {
         $code = $msg['type'];
         $msg = $msg['message'];
     }
     parent::__construct($msg, $code, $previous);
 }
開發者ID:rtsantos,項目名稱:mais,代碼行數:14,代碼來源:Exception.php

示例11: __construct

 public function __construct($message = null)
 {
     if (empty($message)) {
         parent::__construct('There has been an error with your request. (400)', 400);
     } else {
         parent::__construct($message . ' (400)', 400);
     }
 }
開發者ID:vrtulka23,項目名稱:daiquiri,代碼行數:8,代碼來源:BadRequest.php

示例12: getZmaxFile

 /**
  * Get the script where the exeption occurred
  *
  * @retun string the script name
  */
 public function getZmaxFile()
 {
     if ($this->zmax_error) {
         return $this->script;
     } else {
         return parent::getFile();
     }
 }
開發者ID:camilorivera,項目名稱:INNOVARE,代碼行數:13,代碼來源:Exception.php

示例13: __construct

 public function __construct($message = null)
 {
     if (empty($message)) {
         parent::__construct('You are not authorized to view this page. (401)', 401);
     } else {
         parent::__construct($message . ' (401)', 401);
     }
 }
開發者ID:vrtulka23,項目名稱:daiquiri,代碼行數:8,代碼來源:Unauthorized.php

示例14: __construct

 public function __construct($message = null)
 {
     if (empty($message)) {
         parent::__construct('This page does not exist. (404)', 404);
     } else {
         parent::__construct($message . ' (404)', 404);
     }
 }
開發者ID:vrtulka23,項目名稱:daiquiri,代碼行數:8,代碼來源:NotFound.php

示例15:

 /**
  * Constructor
  * @param string $message
  * @param string $code
  * @param int $type
  */
 function __construct($message = 'Exception', $code = 0, $type = CS_Exception::MINOR_ERROR)
 {
     if (empty($code)) {
         $code = crc32(get_class($this));
     }
     $this->_errType = $type;
     parent::__construct($message, $code);
     //self::makeExceptionLog($this);
 }
開發者ID:andybui2014,項目名稱:PocketRecuiter,代碼行數:15,代碼來源:Exception.php


注:本文中的Zend_Exception類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。