本文整理汇总了PHP中PEAR_Error::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_Error::__construct方法的具体用法?PHP PEAR_Error::__construct怎么用?PHP PEAR_Error::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_Error
的用法示例。
在下文中一共展示了PEAR_Error::__construct方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
/**
* Overloaded FileMaker_Error constructor.
*
* @param FileMaker_Delegate &$fm FileMaker_Delegate object this error
* came from.
* @param string $message Error message.
* @param integer $code Error code.
*/
function FileMaker_Error(&$fm, $message = null, $code = null)
{
$this->_fm =& $fm;
parent::__construct($message, $code);
// Log the error.
$fm->log($this->getMessage(), FILEMAKER_LOG_ERR);
}
示例2:
/**
* Mail_Queue_Error constructor.
*
* @param mixed $code Mail_Queue error code, or string with error message.
* @param integer $mode what 'error mode' to operate in
* @param integer $level what error level to use for
* $mode & PEAR_ERROR_TRIGGER
* @param string $debuginfo additional debug info
*/
function Mail_Queue_Error($code = MAILQUEUE_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $file = __FILE__, $line = __LINE__, $debuginfo = '')
{
$debuginfo .= (empty($debuginfo) ? '' : ' - ') . 'FILE: ' . $file . ', LINE: ' . $line;
if (is_int($code)) {
parent::__construct('Mail Queue Error: ' . Mail_Queue::errorMessage($code), $code, $mode, $level, $debuginfo);
} else {
parent::__construct('Mail Queue Error: ' . $code, MAILQUEUE_ERROR, $mode, $level, $debuginfo);
}
}
示例3:
/**
* DB_Error constructor
*
* @param mixed $code DB error code, or string with error message
* @param int $mode what "error mode" to operate in
* @param int $level what error level to use for $mode &
* PEAR_ERROR_TRIGGER
* @param mixed $debuginfo additional debug info, such as the last query
*
* @see PEAR_Error
*/
function __construct($code = DB_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
{
if (is_int($code)) {
parent::__construct('DB Error: ' . DB::errorMessage($code), $code, $mode, $level, $debuginfo);
} else {
parent::__construct("DB Error: {$code}", DB_ERROR, $mode, $level, $debuginfo);
}
}
示例4:
/**
* DB_DataObject_Error constructor.
*
* @param mixed $code DB error code, or string with error message.
* @param integer $mode what "error mode" to operate in
* @param integer $level what error level to use for $mode & PEAR_ERROR_TRIGGER
* @param mixed $debuginfo additional debug info, such as the last query
*
* @access public
*
* @see PEAR_Error
*/
function __construct($message = '', $code = DB_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE)
{
parent::__construct('DB_DataObject Error: ' . $message, $code, $mode, $level);
}
示例5:
/**
* MDB2_Schema_Error constructor.
*
* @param mixed error code, or string with error message.
* @param int what 'error mode' to operate in
* @param int what error level to use for $mode & PEAR_ERROR_TRIGGER
* @param mixed additional debug info, such as the last query
* @access public
*/
function __construct($code = MDB2_SCHEMA_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
{
parent::__construct('MDB2_Schema Error: ' . MDB2_Schema::errorMessage($code), $code, $mode, $level, $debuginfo);
}
示例6: sprintf
/**
* construct a new error instance
*
* You may either pass a message or an xml_parser resource as first
* parameter. If a resource has been passed, the last error that
* happened will be retrieved and returned.
*
* @param string|resource $msgorparser message or parser resource
* @param integer $code error code
* @param integer $mode error handling
* @param integer $level error level
*
* @access public
* @todo PEAR CS - can't meet 85char line limit without arg refactoring
*/
function __construct($msgorparser = 'unknown error', $code = 0, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE)
{
if (is_resource($msgorparser)) {
$code = xml_get_error_code($msgorparser);
$msgorparser = sprintf('%s at XML input line %d:%d', xml_error_string($code), xml_get_current_line_number($msgorparser), xml_get_current_column_number($msgorparser));
}
parent::__construct($msgorparser, $code, $mode, $level);
}
示例7:
/**
* Creates an cache error object.
*
* @param string error message
* @param string file where the error occured
* @param string linenumber where the error occured
*/
function Cache_Error($msg, $file = __FILE__, $line = __LINE__)
{
parent::__construct(sprintf("%s [%s on line %d].", $msg, $file, $line));
}
示例8: __construct
/**
* Creates a quickform error object, extending the PEAR_Error class
*
* @param int $code the error code
* @param int $mode the reaction to the error, either return, die or trigger/callback
* @param int $level intensity of the error (PHP error code)
* @param mixed $debuginfo any information that can inform user as to nature of the error
*/
public function __construct($code = QUICKFORM_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
{
if (is_int($code)) {
parent::__construct(HTML_QuickForm::errorMessage($code), $code, $mode, $level, $debuginfo);
} else {
parent::__construct("Invalid error code: {$code}", QUICKFORM_ERROR, $mode, $level, $debuginfo);
}
}
示例9: __construct
/**
* MDB2_Error constructor.
*
* @param mixed MDB2 error code, or string with error message.
* @param int what 'error mode' to operate in
* @param int what error level to use for $mode & PEAR_ERROR_TRIGGER
* @param mixed additional debug info, such as the last query
*/
public function __construct($code = MDB2_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null, $dummy = null)
{
if (null === $code) {
$code = MDB2_ERROR;
}
parent::__construct('MDB2 Error: ' . MDB2::errorMessage($code), $code, $mode, $level, $debuginfo);
}
示例10: __construct
/**
* Net_LDAP2_Error constructor.
*
* @param string $message String with error message.
* @param integer $code Net_LDAP2 error code
* @param integer $mode what "error mode" to operate in
* @param mixed $level what error level to use for $mode & PEAR_ERROR_TRIGGER
* @param mixed $debuginfo additional debug info, such as the last query
*
* @access public
* @see PEAR_Error
*/
public function __construct($message = 'Net_LDAP2_Error', $code = NET_LDAP2_ERROR, $mode = PEAR_ERROR_RETURN, $level = E_USER_NOTICE, $debuginfo = null)
{
if (is_int($code)) {
parent::__construct($message . ': ' . Net_LDAP2::errorMessage($code), $code, $mode, $level, $debuginfo);
} else {
parent::__construct("{$message}: {$code}", NET_LDAP2_ERROR, $mode, $level, $debuginfo);
}
}