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


PHP ErrorHandler::mapErrorCode方法代码示例

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


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

示例1: handleError

 public static function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     list(, $level) = ErrorHandler::mapErrorCode($code);
     $log_levels = array(LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR);
     if (in_array($level, $log_levels)) {
         return ErrorHandler::handleError($code, $description, $file, $line, $context);
     }
 }
开发者ID:asadaqain,项目名称:Guide-on-the-Side,代码行数:8,代码来源:GotsError.php

示例2: handleError

 public static function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     list(, $level) = ErrorHandler::mapErrorCode($code);
     if ($level === LOG_ERROR) {
         // Ignore fatal error. It will keep the PHP error message only
         return false;
     }
     return ErrorHandler::handleError($code, $description, $file, $line, $context);
 }
开发者ID:manzapanza,项目名称:cakephp-api-utils,代码行数:9,代码来源:AppError.php

示例3: handleError

 /**
  * Handle errors in the console environment. Writes errors to stderr,
  * and logs messages if Configure::read('debug') is 0.
  *
  * @param integer $code Error code
  * @param string $description Description of the error.
  * @param string $file The file the error occurred in.
  * @param integer $line The line the error occurred on.
  * @param array $context The backtrace of the error.
  * @return void
  */
 public function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     if (error_reporting() === 0) {
         return;
     }
     $stderr = self::getStderr();
     list($name, $log) = ErrorHandler::mapErrorCode($code);
     $message = __d('cake_console', '%s in [%s, line %s]', $description, $file, $line);
     $stderr->write(__d('cake_console', "<error>%s Error:</error> %s\n", $name, $message));
     if (Configure::read('debug') == 0) {
         CakeLog::write($log, $message);
     }
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:24,代码来源:ConsoleErrorHandler.php

示例4: handleError

 public static function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     list($name, $level) = ErrorHandler::mapErrorCode($code);
     $message = sprintf("Desc: %s: %s\n", $name, $description);
     $message .= sprintf("File: %s\n", $file);
     $message .= sprintf("Line: %s\n", $line);
     $message .= "\n";
     $message .= print_r($context, true);
     $email = new CakeEmail('default');
     $email->to('kotobukijisan2003@gmail.com');
     $email->subject('CakePHP ERROR');
     $email->send($message);
     return ErrorHandler::handleError($code, $description, $file, $line, $context);
 }
开发者ID:rasken2003,项目名称:CakePHP2-Recipe,代码行数:14,代码来源:AppError.php

示例5: _checkFatalError

 /**
  * Check if a fatal error happened and trigger the configured handler if configured
  *
  * @return void
  */
 protected static function _checkFatalError()
 {
     $lastError = error_get_last();
     if (!is_array($lastError)) {
         return;
     }
     list(, $log) = ErrorHandler::mapErrorCode($lastError['type']);
     if ($log !== LOG_ERR) {
         return;
     }
     if (PHP_SAPI === 'cli') {
         $errorHandler = Configure::read('Error.consoleHandler');
     } else {
         $errorHandler = Configure::read('Error.handler');
     }
     if (!is_callable($errorHandler)) {
         return;
     }
     call_user_func($errorHandler, $lastError['type'], $lastError['message'], $lastError['file'], $lastError['line'], array());
 }
开发者ID:Vighnesh123,项目名称:book-a-bus,代码行数:25,代码来源:App.php

示例6: handleError

 /**
  * Handle errors in the console environment. Writes errors to stderr,
  * and logs messages if Configure::read('debug') is 0.
  *
  * @param int    $code        Error code
  * @param string $description Description of the error.
  * @param string $file        The file the error occurred in.
  * @param int    $line        The line the error occurred on.
  * @param array  $context     The backtrace of the error.
  *
  * @return void
  */
 public function handleError($code, $description, $file = NULL, $line = NULL, $context = NULL)
 {
     if (error_reporting() === 0) {
         return;
     }
     $stderr = static::getStderr();
     list($name, $log) = ErrorHandler::mapErrorCode($code);
     $message = __d('cake_console', '%s in [%s, line %s]', $description, $file, $line);
     $stderr->write(__d('cake_console', "<error>%s Error:</error> %s\n", $name, $message));
     if (!Configure::read('debug')) {
         CakeLog::write($log, $message);
     }
     if ($log === LOG_ERR) {
         return $this->_stop(1);
     }
 }
开发者ID:mrbadao,项目名称:api-official,代码行数:28,代码来源:ConsoleErrorHandler.php


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