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


PHP ErrorHandler::handleError方法代码示例

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


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

示例1: handleError

 public static function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     // Call Bugsnag
     Bugsnag::errorHandler($code, $description, $file, $line, $context);
     // Fall back to cake
     return parent::handleError($code, $description, $file, $line, $context);
 }
开发者ID:morrislaptop,项目名称:bugsnag-cake,代码行数:7,代码来源:BugsnagError.php

示例2: 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

示例3: handleError

 public function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     $cakePath = CAKE_CORE_INCLUDE_PATH . DS . CAKE;
     if (ErrorHandler::handleError($code, $description, $file, $line, $context) !== false && !preg_match('!^' . $cakePath . '!', $file)) {
         $this->handleException(new ErrorException($description, 0, $code, $file, $line));
         return true;
     }
     return false;
 }
开发者ID:k1low,项目名称:exception,代码行数:9,代码来源:ExceptionNotifierComponent.php

示例4: 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

示例5: handleError

 public static function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     try {
         $e = new ErrorException($description, 0, $code, $file, $line);
         self::sentryLog($e);
         return parent::handleError($code, $description, $file, $line, $context);
     } catch (Exception $e) {
         self::handleException($e);
     }
 }
开发者ID:parallax,项目名称:cake-sentry,代码行数:10,代码来源:SentryErrorHandler.php

示例6: execute_request

function execute_request(Request $request, Response $response, $dispatchPath)
{
    $dispatchList = (require $dispatchPath);
    $result = Dispatcher::dispatch($dispatchList, $request);
    if ($result[0] === false) {
        $response->set_status_code(404);
        $body = ErrorHandler::handleError(404, $request, 'Resource was not found');
        $response->write($body);
        return $response;
    } else {
        return \PHPMachine\DecisionCore::handleRequest($result[0], $request, $response);
    }
}
开发者ID:reflowstudio,项目名称:phpmachine,代码行数:13,代码来源:PHPMachine.php

示例7: 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

示例8: handleError

 /**
  * This method is used as the central entry point to the APF's error management. It delegates the
  * error handling to the registered handler. In case no handler is registered or the mechanism is
  * disables, nothing will happen.
  *
  * @param int $errorNumber The error number.
  * @param string $errorMessage The error message.
  * @param string $errorFile The file the error occurred in.
  * @param int $errorLine The line the error occurred at.
  *
  * @author Christian Achatz
  * @version
  * Version 0.1, 03.03.2012<br />
  */
 public static function handleError($errorNumber, $errorMessage, $errorFile, $errorLine)
 {
     // Don't raise error, if @ was applied
     if (error_reporting() == 0) {
         return;
     }
     if (self::$HANDLER === null) {
         // restore the PHP default error handler to avoid loops or other issues
         restore_error_handler();
         trigger_error($errorMessage, (int) $errorNumber);
     } else {
         self::$HANDLER->handleError($errorNumber, $errorMessage, $errorFile, $errorLine);
     }
 }
开发者ID:GeneralCrime,项目名称:code,代码行数:28,代码来源:GlobalErrorHandler.php

示例9: respond

 protected static function respond($code, DecisionCoreState $state)
 {
     $request = $state->request;
     $response = $state->response;
     if ($code == 404) {
         $response->write(ErrorHandler::handleError($code, $request, 'Resource was not found'));
     } elseif ($code == 304) {
         // TODO
         // remove Content-Type header
         // generate ETag
         // Get Expires
     }
     $response->set_status_code($code);
     static::callResource('finishRequest', $state);
     $response->add_metadata('end-time', microtime(true));
     return 'stop';
 }
开发者ID:reflowstudio,项目名称:phpmachine,代码行数:17,代码来源:DecisionCore.php

示例10: handleError

 public static function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     parent::handleError($code, $description, $file, $line, $context);
     $errorConf = Configure::read('Error');
     if (!($errorConf['level'] & $code)) {
         return;
     }
     $force = Configure::read('ExceptionNotifier.force');
     $debug = Configure::read('debug');
     if (!$force && $debug > 0) {
         return;
     }
     list($error, $log) = self::mapErrorCode($code);
     $prefix = Configure::read('ExceptionNotifier.prefix');
     $subject = $prefix . '[' . date('Ymd H:i:s') . '][' . strtoupper($error) . '][' . ExceptionText::getUrl() . '] ' . $description;
     $body = ExceptionText::getBody($error . ':' . $description, $file, $line, $context);
     return ExceptionMail::send($subject, $body);
 }
开发者ID:k1low,项目名称:exception,代码行数:18,代码来源:ExceptionNotifierErrorHandler.php

示例11: testNotFoundPageShowsCorrectCopyWhenVerboseErrorsDisabled

 public function testNotFoundPageShowsCorrectCopyWhenVerboseErrorsDisabled()
 {
     $original = Settings::getSettings();
     $settings = $original;
     $settings['errors']['verbose'] = false;
     Settings::setFromArray($settings);
     try {
         $this->request->dispatch("/notfound");
     } catch (Exception $e) {
         $handler = new ErrorHandler();
         $handler->setRequest($this->request);
         $handler->handleError($e);
         $this->assertResponseCode(404, $handler->getResponse());
         $this->assertBodyHasContents("Oops! That&rsquo;s a 404", $handler->getResponse());
         $this->assertBodyHasContents("It looks like the page you&rsquo;re after doesn&rsquo;t exist", $handler->getResponse());
     }
     Settings::setFromArray($original);
 }
开发者ID:Asedol,项目名称:paynedigital.com,代码行数:18,代码来源:DefaultControllerTest.php

示例12: handleError

 /**
  * HandleError
  *
  * @param integer $code Code of error
  * @param string $description Error description
  * @param string $file File on which error occurred
  * @param integer $line Line that triggered the error
  * @param array $context Context
  * @return boolean true if error was handled
  */
 public static function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     extract(self::handlerSettings());
     $args = compact('code', 'description', 'file', 'line', 'context', 'session');
     if ($emailNotifications === true && !empty($receiver)) {
         $cacheHash = 'error-' . md5(serialize(compact($args)));
         self::setCacheConfig($duration);
         if (Cache::read($cacheHash, 'error_handler') === false || $caching === false) {
             list($error, $log) = self::mapErrorCode($code);
             if (in_array($log, $logLevels) || in_array($code, $codes)) {
                 $trace = Debugger::trace(array('start' => 1, 'format' => 'log'));
                 $session = CakeSession::read();
                 $server = $_SERVER;
                 $request = $_REQUEST;
                 $Email = self::getEmailInstance();
                 $Email->viewVars(compact('code', 'description', 'file', 'line', 'context', 'session', 'server', 'request', 'trace'));
                 $Email->send();
             }
             Cache::write($cacheHash, true, 'error_handler');
         }
     }
     return parent::handleError($code, $description, $file, $line, $context);
 }
开发者ID:beyondkeysystem,项目名称:testone,代码行数:33,代码来源:EmailErrorHandler.php

示例13: testHandleError

 public function testHandleError()
 {
     $this->assertTrue(ErrorHandler::handleError('FooCode', 'FooMessage', 'FooFile', 'FooLine', 'FooContext'));
 }
开发者ID:mlessnau,项目名称:pry,代码行数:4,代码来源:ErrorHandlerTest.php

示例14: handleFatalError

 /**
  * shut down functions handler
  *
  */
 public static function handleFatalError()
 {
     $error = error_get_last();
     ErrorHandler::handleError($error['type'], $error["message"], $error["file"], $error["line"]);
 }
开发者ID:smoogie,项目名称:errorlog,代码行数:9,代码来源:ErrorHandler.php

示例15: handleError

 public static function handleError($code, $description, $file = null, $line = null, $context = null)
 {
     $errbitCake = new ErrbitCakePHP();
     $errbitCake->onError($code, $description, $file, $line);
     return parent::handleError($code, $description, $file, $line, $context);
 }
开发者ID:vinco,项目名称:vo-errbit-cake,代码行数:6,代码来源:ErrbitCakePHP.php


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