本文整理汇总了PHP中Zend_Exception类的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Exception类的具体用法?PHP Zend_Exception怎么用?PHP Zend_Exception使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Zend_Exception类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: __construct
/**
* @param string
*/
public function __construct($message)
{
if (func_num_args() > 1) {
$params = func_get_args();
$params[0] = $message;
$message = call_user_func_array("sprintf", $params);
}
parent::__construct($message);
}
开发者ID:phpscr,项目名称:usvn,代码行数:12,代码来源:Exception.php
示例17: __construct
/**
*
* @var type
* /
private $_stacktrace;
/**
* Construct the exception
*
* @param string $msg
* @param int $code
* @param \Exception $previous
* @param array $stacktrace
* @return void
*/
public function __construct($msg = '', $code = 0, \Exception $previous = null)
{
parent::__construct($msg, $code, $previous);
/*
$this->_stacktrace = debug_backtrace(false);
// Remove this line
array_shift($this->_stacktrace);
// */
}
开发者ID:GemsTracker,项目名称:MUtil,代码行数:25,代码来源:LazyException.php
示例18: __construct
public function __construct($msg = '', $code = 0, Exception $previous = null)
{
if (is_array($msg)) {
$txt = '';
foreach ($msg as $key => $value) {
$txt .= $key . ': ' . $value . ' \\n ';
}
$msg = $txt;
}
parent::__construct($msg, $code, $previous);
}
开发者ID:brunopbaffonso,项目名称:ongonline,代码行数:11,代码来源:Exception.php
示例19: __construct
/**
* Erstellt die Ausnahme mit der Möglichkeit zusätzliche Daten anzugeben
* @param string $message
* @param array $data
* @param int $code
* @param Exception $previous
*/
public function __construct($message = '', array $data = array(), $code = 0, Exception $previous = null)
{
if (isset($previous)) {
if ($message == '') {
$message = $previous->getMessage();
}
if (count($data) == 0 && $previous instanceof Dragon_Application_Exception_Abstract) {
$data = $previous->getData();
}
if ($code == 0) {
$code = $previous->getCode();
}
}
$this->_data = $data;
parent::__construct($message, $code, $previous);
}
开发者ID:dragonprojects,项目名称:dragonjsonserver,代码行数:23,代码来源:Abstract.php
示例20: __construct
public function __construct($msg = '', $code = 0, Exception $previous = null)
{
// just pass ahead if it was throw from the CLI
if (php_sapi_name() == "cli") {
return parent::__construct($msg, (int) $code, $previous);
} else {
parent::__construct($msg, (int) $code, $previous);
$response = new Zend_Controller_Response_Http();
$response->setHttpResponseCode(500);
ob_get_clean();
ob_start();
require APPLICATION_PATH . "/layout/scripts/exception.phtml";
$outputBuffer = ob_get_clean();
$response->setBody($outputBuffer);
$response->sendResponse();
trigger_error($msg, E_USER_ERROR);
exit;
}
}
开发者ID:henvic,项目名称:MediaLab,代码行数:19,代码来源:Exception.php
注:本文中的Zend_Exception类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论