当前位置: 首页>>代码示例>>PHP>>正文


PHP exception::__construct方法代码示例

本文整理汇总了PHP中exception::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP exception::__construct方法的具体用法?PHP exception::__construct怎么用?PHP exception::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在exception的用法示例。


在下文中一共展示了exception::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

	public function __construct ($message = null, $code = 0)
	{
		parent::__construct($message, $code);
		$this->stage  = coren::current_stage ();
		$this->module = coren::current_module();
		$this->method = coren::current_method();
	}
开发者ID:nolar,项目名称:coren,代码行数:7,代码来源:coren.php

示例2: __construct

 public function __construct($message, $engmessage, $data = NULL)
 {
     parent::__construct($message);
     if (!is_null($data)) {
         $this->data = $data;
     }
 }
开发者ID:rubythonode,项目名称:limepie-php,代码行数:7,代码来源:exception.php

示例3: __construct

 /**
  * Constructor
  */
 public function __construct($code, $string, $file, $line, $context)
 {
     parent::__construct($string, $code);
     die($string);
     // override line and file to match error
     $this->line = $line;
     $this->file = $file;
     // save context, in an extended propertie
     $this->context = $context;
 }
开发者ID:laiello,项目名称:phpbf,代码行数:13,代码来源:BF_php_exception.php

示例4: __construct

 public function __construct($errno, $errstr, $file, $line)
 {
     switch ($errno) {
         case E_ERROR:
             $str_type = 'E_ERROR';
             break;
         case E_WARNING:
             $str_type = 'E_WARNING';
             break;
         case E_PARSE:
             $str_type = 'E_PARSE';
             break;
         case E_NOTICE:
             $str_type = 'E_NOTICE';
             break;
         case E_CORE_ERROR:
             $str_type = 'E_CORE_ERROR';
             break;
         case E_CORE_WARNING:
             $str_type = 'E_CORE_WARNING';
             break;
         case E_COMPILE_ERROR:
             $str_type = 'E_COMPILE_ERROR';
             break;
         case E_COMPILE_WARNING:
             $str_type = 'E_COMPILE_WARNING';
             break;
         case E_USER_ERROR:
             $str_type = 'E_USER_ERROR';
             break;
         case E_USER_WARNING:
             $str_type = 'E_USER_WARNING';
             break;
         case E_USER_NOTICE:
             $str_type = 'E_USER_NOTICE';
             break;
         case E_STRICT:
             $str_type = 'E_STRICT';
             break;
         default:
             $str_type = sprintf('E_%d', $errno);
             break;
     }
     $message = sprintf('%s: %s at [%s:%d]', $str_type, $errstr, $file, $line);
     parent::__construct($message, $errno);
     $this->php_error_code = $errno;
     $this->php_error_code_str = $str_type;
     $this->php_error_message = $errstr;
     $this->php_error_file = $file;
     $this->php_error_line = $line;
 }
开发者ID:ctiborv,项目名称:spitzen-wein.ch,代码行数:51,代码来源:mod_debug_handlers.inc.php

示例5:

 function __construct($title, $err_no = 0)
 {
     if (!defined('TF_TEST_INFECTED')) {
         $this->log_id = false;
         if ($err_no == self::CRITICAL) {
             echo "<h1 style='color:darkred'>Danger! {$title} </h1>";
         } else {
             // log if logger available
             if ($this->logable && class_exists('core') && ($libs = core::get_libs()) && $libs->is_registered('logger') && ($logger = core::lib('logger'))) {
                 $this->log_id = $logger->error_log($title, $err_no, $this->getTraceAsString());
             }
         }
         // display?
     }
     // var_dump($title, $err_no, $this->getTraceAsString());
     parent::__construct($title, $err_no);
     self::$last_exception = $this;
 }
开发者ID:rustyJ4ck,项目名称:moswarBot,代码行数:18,代码来源:exception.php

示例6:

 function __construct($title, $err_no = 0)
 {
     if (class_exists('loader', false) && !loader::_option(loader::OPTION_TESTING)) {
         $this->log_id = false;
         if ($err_no == self::CRITICAL) {
             echo "<h1 style='color:darkred'>Danger! {$title} </h1>";
         } else {
             // override email
             if (class_exists('core', 0) && core::selfie()) {
                 $this->bugs_email = core::selfie()->cfg('email', $this->bugs_email);
             }
             // log if logger available
             if ($this->logable && class_exists('core', 0) && ($libs = core::libs()) && $libs->is_registered('logger') && ($logger = core::lib('logger'))) {
                 $this->log_id = $logger->error($title, $err_no, $this->getTraceAsString());
             }
         }
     }
     parent::__construct($title, $err_no);
     self::$last_exception = $this;
 }
开发者ID:egregor-dev,项目名称:SatCMS,代码行数:20,代码来源:exceptions.php

示例7: __construct

 /**
  * generer une erreur HTML2PDF
  * 
  * @param	int		numero de l'erreur
  * @param	mixed	indications suplementaires sur l'erreur
  * @return	string	code HTML eventuel associé à l'erreur
  */
 public final function __construct($err = 0, $other = null, $html = '')
 {
     // creation du message d'erreur
     $msg = '';
     switch ($err) {
         case 1:
             $msg = HTML2PDF::textGET('err01');
             $msg = str_replace('[[OTHER]]', $other, $msg);
             $this->tag = $other;
             break;
         case 2:
             $msg = HTML2PDF::textGET('err02');
             $msg = str_replace('[[OTHER_0]]', $other[0], $msg);
             $msg = str_replace('[[OTHER_1]]', $other[1], $msg);
             $msg = str_replace('[[OTHER_2]]', $other[2], $msg);
             break;
         case 3:
             $msg = HTML2PDF::textGET('err03');
             $msg = str_replace('[[OTHER]]', $other, $msg);
             $this->tag = $other;
             break;
         case 4:
             $msg = HTML2PDF::textGET('err04');
             $msg = str_replace('[[OTHER]]', print_r($other, true), $msg);
             break;
         case 5:
             $msg = HTML2PDF::textGET('err05');
             $msg = str_replace('[[OTHER]]', print_r($other, true), $msg);
             break;
         case 6:
             $msg = HTML2PDF::textGET('err06');
             $msg = str_replace('[[OTHER]]', $other, $msg);
             $this->image = $other;
             break;
         case 7:
             $msg = HTML2PDF::textGET('err07');
             break;
         case 8:
             $msg = HTML2PDF::textGET('err08');
             $msg = str_replace('[[OTHER]]', $other, $msg);
             $this->tag = $other;
             break;
         case 9:
             $msg = HTML2PDF::textGET('err09');
             $msg = str_replace('[[OTHER_0]]', $other[0], $msg);
             $msg = str_replace('[[OTHER_1]]', $other[1], $msg);
             $this->tag = $other[0];
             break;
     }
     // creation du message HTML
     $this->message_html = '<span style="color: #AA0000; font-weight: bold;">' . HTML2PDF::textGET('txt01') . $err . '</span><br>';
     $this->message_html .= HTML2PDF::textGET('txt02') . ' ' . $this->file . '<br>';
     $this->message_html .= HTML2PDF::textGET('txt03') . ' ' . $this->line . '<br>';
     $this->message_html .= '<br>';
     $this->message_html .= $msg;
     // creation du message classique
     $msg = HTML2PDF::textGET('txt01') . $err . ' : ' . strip_tags($msg);
     if ($html) {
         $this->message_html .= "<br><br>HTML : ..." . trim(htmlentities($html)) . '...';
         $this->html = $html;
         $msg .= ' HTML : ...' . trim($html) . '...';
     }
     parent::__construct($msg, $err);
 }
开发者ID:bosokpp1,项目名称:cipaganti-rentcar,代码行数:71,代码来源:html2pdf.class.php

示例8: __construct

 /**
  * generate a HTML2PDF exception
  *
  * @param    int $err error number
  * @param    mixed $other additionnal informations
  * @return   string  $html optionnal code HTML associated to the error
  */
 public final function __construct($err = 0, $other = null, $html = '')
 {
     // read the error
     switch ($err) {
         case 1:
             // Unsupported tag
             $msg = HTML2PDF_locale::get('err01');
             $msg = str_replace('[[OTHER]]', $other, $msg);
             $this->_tag = $other;
             break;
         case 2:
             // too long sentence
             $msg = HTML2PDF_locale::get('err02');
             $msg = str_replace('[[OTHER_0]]', $other[0], $msg);
             $msg = str_replace('[[OTHER_1]]', $other[1], $msg);
             $msg = str_replace('[[OTHER_2]]', $other[2], $msg);
             break;
         case 3:
             // closing tag in excess
             $msg = HTML2PDF_locale::get('err03');
             $msg = str_replace('[[OTHER]]', $other, $msg);
             $this->_tag = $other;
             break;
         case 4:
             // tags closed in the wrong order
             $msg = HTML2PDF_locale::get('err04');
             $msg = str_replace('[[OTHER]]', print_r($other, true), $msg);
             break;
         case 5:
             // unclosed tag
             $msg = HTML2PDF_locale::get('err05');
             $msg = str_replace('[[OTHER]]', print_r($other, true), $msg);
             break;
         case 6:
             // image can not be loaded
             $msg = HTML2PDF_locale::get('err06');
             $msg = str_replace('[[OTHER]]', $other, $msg);
             $this->_image = $other;
             break;
         case 7:
             // too big TD content
             $msg = HTML2PDF_locale::get('err07');
             break;
         case 8:
             // SVG tag not in DRAW tag
             $msg = HTML2PDF_locale::get('err08');
             $msg = str_replace('[[OTHER]]', $other, $msg);
             $this->_tag = $other;
             break;
         case 9:
             // deprecated
             $msg = HTML2PDF_locale::get('err09');
             $msg = str_replace('[[OTHER_0]]', $other[0], $msg);
             $msg = str_replace('[[OTHER_1]]', $other[1], $msg);
             $this->_tag = $other[0];
             break;
         case 0:
             // specific error
         // specific error
         default:
             $msg = $other;
             break;
     }
     // create the HTML message
     $this->_messageHtml = '<span style="color: #AA0000; font-weight: bold;">' . HTML2PDF_locale::get('txt01', 'error: ') . $err . '</span><br>';
     $this->_messageHtml .= HTML2PDF_locale::get('txt02', 'file:') . ' ' . $this->file . '<br>';
     $this->_messageHtml .= HTML2PDF_locale::get('txt03', 'line:') . ' ' . $this->line . '<br>';
     $this->_messageHtml .= '<br>';
     $this->_messageHtml .= $msg;
     // create the text message
     $msg = HTML2PDF_locale::get('txt01', 'error: ') . $err . ' : ' . strip_tags($msg);
     // add the optionnal html content
     if ($html) {
         $this->_messageHtml .= "<br><br>HTML : ..." . trim(htmlentities($html)) . '...';
         $this->_html = $html;
         $msg .= ' HTML : ...' . trim($html) . '...';
     }
     // save the other informations
     $this->_other = $other;
     // construct the exception
     parent::__construct($msg, $err);
 }
开发者ID:roger-jb,项目名称:edeip,代码行数:89,代码来源:exception.class.php

示例9:

 function __construct($message)
 {
     parent::__construct($message);
 }
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:4,代码来源:forum_exception.php

示例10: __construct

 public function __construct(_Extruct_SpecError $oError)
 {
     //
     // Takes a _Extruct_SpecError instance as its only parameter.
     // Not to be used externally.
     //
     $this->Stack = $oError->Stack;
     parent::__construct($oError->getMessage() . " (" . implode('/', $this->Stack));
 }
开发者ID:appcove,项目名称:Extruct,代码行数:9,代码来源:__init__.php

示例11: __construct

 public function __construct($message = null, $code = 0, $data = null, Exception $previous = null)
 {
     $this->data = (array) $data;
     parent::__construct($message, $code, $previous);
 }
开发者ID:xrogaan,项目名称:php-errornot,代码行数:5,代码来源:errornot_exception.php

示例12: __construct

 public function __construct($msg)
 {
     parent::__construct($msg);
 }
开发者ID:kisshc,项目名称:frame,代码行数:4,代码来源:exception.php

示例13: __construct

 /**
  * Constructor
  * @param	string	$message [optional default null] : A message to display to user (will be translated if needed). Null for default message
  * @param	string	$title [optional default null'] : Title of the error box to display (will be translated if needed). Null for default title
  */
 public function __construct($message = null, $title = null)
 {
     // set the display param
     $this->display = array('message' => $message, 'title' => $title);
     parent::__construct($message);
 }
开发者ID:laiello,项目名称:phpbf,代码行数:11,代码来源:framework.php

示例14: __construct

 /**
  * Constructor.
  *
  * @param object|array    $instance Required at all times.
  *    A parent object instance, which contains the parent's `$instance`,
  *    or a new `$instance` array.
  *
  * @param string          $code Optional error code (string, NO integers please).
  *
  * @param null|mixed      $data Optional exception data (i.e. something to assist in reporting/logging).
  *    This argument can be bypassed using a NULL value (that's fine).
  *
  * @param string          $message Optional exception message (i.e. an error message).
  *
  * @param null|\exception $previous Optional previous exception (if re-thrown).
  *
  * @throws \exception If there is a missing and/or invalid `$instance`.
  * @throws \exception A standard exception class; if any additional issues occur during this type of exception.
  *    This prevents endless exceptions, which may occur when/if we make use of a plugin instance.
  */
 public function __construct($instance = NULL, $code = 'exception', $data = NULL, $message = '', \exception $previous = NULL)
 {
     try {
         if ($instance instanceof framework) {
             $plugin_root_ns = $instance->instance->plugin_root_ns;
         } else {
             if (is_array($instance) && !empty($instance['plugin_root_ns'])) {
                 $plugin_root_ns = (string) $instance['plugin_root_ns'];
             }
         }
         if (empty($plugin_root_ns) || !isset($GLOBALS[$plugin_root_ns]) || !$GLOBALS[$plugin_root_ns] instanceof framework) {
             throw new \exception(sprintf(stub::__('Invalid `$instance` to constructor: `%1$s`'), print_r($instance, TRUE)));
         }
         $this->plugin = $GLOBALS[$plugin_root_ns];
         $code = (string) $code ? (string) $code : 'exception';
         $message = (string) $message ? (string) $message : sprintf($this->plugin->__('Exception code: `%1$s`.'), $code);
         parent::__construct($message, 0, $previous);
         // Call parent constructor.
         $this->code = $code;
         // Set code for this instance. We always use string exception codes (no exceptions :-).
         $this->data = $data;
         // Optional diagnostic data associated with this exception (possibly a NULL value).
         $this->wp_debug_log();
         // Possible debug logging.
         $this->db_log();
         // Possible database logging routine.
     } catch (\exception $_exception) {
         throw new \exception(sprintf(stub::__('Could NOT instantiate exception code: `%1$s` with message: `%2$s`.'), $code, $message) . ' ' . sprintf(stub::__('Failure caused by exception code: `%1$s` with message: `%2$s`.'), $_exception->getCode(), $_exception->getMessage()), 20, $_exception);
     }
 }
开发者ID:panvagenas,项目名称:x-related-posts,代码行数:50,代码来源:exception.php

示例15: __construct

 public function __construct($msg, $that)
 {
     parent::__construct($msg);
     $this->throwee = $that;
 }
开发者ID:LupusMichaelis,项目名称:horn,代码行数:5,代码来源:exception.php


注:本文中的exception::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。