本文整理汇总了PHP中Zend_Exception::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Exception::__construct方法的具体用法?PHP Zend_Exception::__construct怎么用?PHP Zend_Exception::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Exception
的用法示例。
在下文中一共展示了Zend_Exception::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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);
}
}
示例2: __construct
public function __construct($message, $op1 = null, $op2 = null, $result = null)
{
$this->op1 = $op1;
$this->op2 = $op2;
$this->result = $result;
parent::__construct($message);
}
示例3: __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);
}
示例4: __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);
}
示例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);
}
}
示例6: __construct
public function __construct($message = null)
{
if (empty($message)) {
parent::__construct('This page does not exist. (404)', 404);
} else {
parent::__construct($message . ' (404)', 404);
}
}
示例7: __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);
}
}
示例8: __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);
}
示例9: __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);
}
}
示例10: __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);
}
示例11:
/**
* 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);
}
示例12: __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);
// */
}
示例13: __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);
}
示例14: __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);
}
示例15: __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;
}
}