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


PHP PEAR_Error::getUserInfo方法代码示例

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


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

示例1: __construct

 /**
  * @param PEAR_Error $error
  */
 public function __construct(PEAR_Error $error)
 {
     $message = $error->getMessage();
     $userInfo = $error->getUserInfo();
     if (!is_null($userInfo)) {
         $message .= ', ' . $userInfo;
     }
     parent::__construct($message);
     $backtrace = $error->getBacktrace();
     if (is_array($backtrace)) {
         $this->file = $backtrace[1]['file'];
         $this->line = $backtrace[1]['line'];
     }
 }
开发者ID:nyarla,项目名称:fluxflex-rep2ex,代码行数:17,代码来源:Exception.php

示例2: _getPearTrace

 /**
  * Return a trace for the PEAR error.
  *
  * @param PEAR_Error $error The PEAR error.
  *
  * @return string The backtrace as a string.
  */
 private function _getPearTrace(PEAR_Error $error)
 {
     $pear_error = '';
     $backtrace = $error->getBacktrace();
     if (!empty($backtrace)) {
         $pear_error .= 'PEAR backtrace:' . "\n\n";
         foreach ($backtrace as $frame) {
             $pear_error .= (isset($frame['class']) ? $frame['class'] : '') . (isset($frame['type']) ? $frame['type'] : '') . (isset($frame['function']) ? $frame['function'] : 'unkown') . ' ' . (isset($frame['file']) ? $frame['file'] : 'unkown') . ':' . (isset($frame['line']) ? $frame['line'] : 'unkown') . "\n";
         }
     }
     $userinfo = $error->getUserInfo();
     if (!empty($userinfo)) {
         $pear_error .= "\n" . 'PEAR user info:' . "\n\n";
         if (is_string($userinfo)) {
             $pear_error .= $userinfo;
         } else {
             $pear_error .= print_r($userinfo, true);
         }
     }
     return $pear_error;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:28,代码来源:Pear.php

示例3: pear_handle_error

/**
 * Callback called when PEAR throws an error
 *
 * @param PEAR_Error $error
 */
function pear_handle_error($error)
{
    echo '<strong>' . $error->GetMessage() . '</strong> ' . $error->getUserInfo();
    echo '<br /> <strong>Backtrace </strong>:';
    print_object($error->backtrace);
}
开发者ID:educacionbe,项目名称:cursos,代码行数:11,代码来源:formslib.php

示例4: pushPEARError

 /**
  * Adds a PEAR error to the stack for the package.
  *
  * @param PEAR_Error $error
  * @param integer    $code
  * @param string     $message
  * @param string     $level
  * @param array      $params
  * @param array      $backtrace
  */
 function pushPEARError($error, $code, $message = false, $level = 'exception', $params = array(), $backtrace = false)
 {
     $time = explode(' ', microtime());
     $time = $time[1] + $time[0];
     if (!$backtrace) {
         $backtrace = debug_backtrace();
     }
     Piece_Unity_Error::push($code, $message, 'exception', $params, array('code' => $error->getCode(), 'message' => $error->getMessage(), 'params' => array('userinfo' => $error->getUserInfo(), 'debuginfo' => $error->getDebugInfo()), 'package' => 'PEAR', 'level' => 'exception', 'time' => $time), $backtrace);
 }
开发者ID:nyarla,项目名称:fluxflex-rep2ex,代码行数:19,代码来源:Error.php

示例5: onPearError

 /**
  * PEAR error handler
  *
  * @param object $error PEAR Error object
  *
  * @return void
  * @ignore
  */
 public static function onPearError(PEAR_Error $error)
 {
     $trace = debug_backtrace();
     array_shift($trace);
     array_shift($trace);
     array_shift($trace);
     $options['file'] = $trace[0]['file'];
     $options['line'] = $trace[0]['line'];
     $options['trace'] = $trace;
     $options['package'] = self::PACKAGE_PEAR;
     $debugInfo = $error->getDebugInfo();
     $userInfo = $error->getUserInfo();
     $trace = $error->getBackTrace();
     $info = array('Error Type' => $error->getType(), 'Debug Info' => $error->getUserInfo());
     if ($debugInfo !== $userInfo) {
         $info['User Info'] = $userInfo;
     }
     if (self::$_config[self::CONFIG_DEBUG] === true) {
         self::error('PEAR Error', $error->getCode() . ' ' . $error->getMessage(), $info, $options);
     } else {
         error_log('PEAR Error' . $error->getCode() . ' ' . $error->getMessage() . " in file[{$options['file']}] on line [{$options['line']}", 0);
     }
 }
开发者ID:sssAlchemy,项目名称:Panda,代码行数:31,代码来源:Panda.php

示例6: get_detail_error_msg

/**
 * Returns the detailled error message of an PEAR_Error or an Exception
 *
 * @param PEAR_Error|Exception $error Error object
 *
 * @return string Detailled error message
 */
function get_detail_error_msg($error)
{
    if ($error instanceof Exception) {
        $msg = $error->__toString();
    } else {
        if ($error instanceof PEAR_Error) {
            $msg = $error->getMessage() . '... ' . $error->getUserInfo();
        } else {
            $msg = (string) $error;
        }
    }
    return $msg;
}
开发者ID:stof,项目名称:pearweb,代码行数:20,代码来源:pear-format-html.php

示例7: errorHandler

 /**
  * エラー処理用をおこなう
  *
  * PEAR_Error のインスタンス作成時に呼ばれるコールバック関数
  *
  * @static
  * @param PEAR_Error $error
  */
 function errorHandler($error)
 {
     if (OPENPNE_DB_ERROR_LOG) {
         require_once 'Log.php';
         $msg = sprintf("msg:-> %s\t info:-> %s", $error->getMessage(), $error->getUserInfo());
         $log = OPENPNE_VAR_DIR . '/log/db_errors.log';
         $file =& Log::singleton('file', $log, 'db', null, PEAR_LOG_ERR);
         $file->log($msg, PEAR_LOG_ERR);
     }
 }
开发者ID:KimuraYoichi,项目名称:PukiWiki,代码行数:18,代码来源:DB.php

示例8: PEAR_ErrorToPEAR_Exception

function PEAR_ErrorToPEAR_Exception(PEAR_Error $err)
{
    //DB_DataObject throws error when an empty set would be returned
    //That behavior is weird, and not how the rest of StatusNet works.
    //So just ignore those errors.
    if ($err->getCode() == DB_DATAOBJECT_ERROR_NODATA) {
        return;
    }
    $msg = $err->getMessage();
    $userInfo = $err->getUserInfo();
    // Log this; push the message up as an exception
    common_log(LOG_ERR, "PEAR Error: {$msg} ({$userInfo})");
    // HACK: queue handlers get kicked by the long-query killer, and
    // keep the same broken connection. We die here to get a new
    // process started.
    if (php_sapi_name() == 'cli' && preg_match('/nativecode=2006/', $userInfo)) {
        common_log(LOG_ERR, "Lost DB connection; dying.");
        exit(100);
    }
    if ($err->getCode()) {
        throw new PEAR_Exception($err->getMessage(), $err->getCode());
    }
    throw new PEAR_Exception($err->getMessage());
}
开发者ID:phpsource,项目名称:gnu-social,代码行数:24,代码来源:framework.php


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