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


PHP Helpers::improveException方法代码示例

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


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

示例1: render

 /**
  * render.
  *
  * @method render
  *
  * @param \Exception $exception
  *
  * @return string
  */
 public function render(Exception $exception)
 {
     $exception = $this->fixStack($exception, error_get_last());
     ob_start();
     Helpers::improveException($exception);
     Debugger::getBlueScreen()->render($exception);
     return ob_get_clean();
 }
开发者ID:recca0120,项目名称:laravel-tracy,代码行数:17,代码来源:BlueScreen.php

示例2: exceptionHandler

 /**
  * Handler to catch uncaught exception.
  * @param  \Exception|\Throwable
  * @return void
  * @internal
  */
 public static function exceptionHandler($exception, $exit = TRUE)
 {
     if (!self::$reserved) {
         return;
     }
     self::$reserved = NULL;
     if (!headers_sent()) {
         $protocol = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1';
         $code = isset($_SERVER['HTTP_USER_AGENT']) && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE ') !== FALSE ? 503 : 500;
         header("{$protocol} {$code}", TRUE, $code);
         if (self::isHtmlMode()) {
             header('Content-Type: text/html; charset=UTF-8');
         }
     }
     Helpers::improveException($exception);
     if (self::$productionMode) {
         try {
             self::log($exception, self::EXCEPTION);
         } catch (\Throwable $e) {
         } catch (\Exception $e) {
         }
         if (self::isHtmlMode()) {
             $logged = empty($e);
             require self::$errorTemplate ?: __DIR__ . '/assets/Debugger/error.500.phtml';
         } elseif (PHP_SAPI === 'cli') {
             fwrite(STDERR, 'ERROR: application encountered an error and can not continue. ' . (isset($e) ? "Unable to log error.\n" : "Error was logged.\n"));
         }
     } elseif (!connection_aborted() && self::isHtmlMode()) {
         self::getBlueScreen()->render($exception);
         if (self::$showBar) {
             self::getBar()->render();
         }
     } else {
         self::fireLog($exception);
         $s = get_class($exception) . ($exception->getMessage() === '' ? '' : ': ' . $exception->getMessage()) . ' in ' . $exception->getFile() . ':' . $exception->getLine() . "\nStack trace:\n" . $exception->getTraceAsString();
         try {
             $file = self::log($exception, self::EXCEPTION);
             if ($file && !headers_sent()) {
                 header("X-Tracy-Error-Log: {$file}");
             }
             echo "{$s}\n" . ($file ? "(stored in {$file})\n" : '');
             if ($file && self::$browser) {
                 exec(self::$browser . ' ' . escapeshellarg($file));
             }
         } catch (\Throwable $e) {
             echo "{$s}\nUnable to log error: {$e->getMessage()}\n";
         } catch (\Exception $e) {
             echo "{$s}\nUnable to log error: {$e->getMessage()}\n";
         }
     }
     try {
         $e = NULL;
         foreach (self::$onFatalError as $handler) {
             call_user_func($handler, $exception);
         }
     } catch (\Throwable $e) {
     } catch (\Exception $e) {
     }
     if ($e) {
         try {
             self::log($e, self::EXCEPTION);
         } catch (\Throwable $e) {
         } catch (\Exception $e) {
         }
     }
     if ($exit) {
         exit($exception instanceof \Error ? 255 : 254);
     }
 }
开发者ID:DIPcom,项目名称:Sandmin,代码行数:75,代码来源:Debugger.php

示例3: errorHandler

 /**
  * Handler to catch warnings and notices.
  * @return bool   FALSE to call normal error handler, NULL otherwise
  * @throws ErrorException
  * @internal
  */
 public static function errorHandler($severity, $message, $file, $line, $context)
 {
     if (self::$scream) {
         error_reporting(E_ALL);
     }
     if ($severity === E_RECOVERABLE_ERROR || $severity === E_USER_ERROR) {
         if (Helpers::findTrace(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS), '*::__toString')) {
             $previous = isset($context['e']) && ($context['e'] instanceof \Exception || $context['e'] instanceof \Throwable) ? $context['e'] : NULL;
             $e = new ErrorException($message, 0, $severity, $file, $line, $previous);
             $e->context = $context;
             self::exceptionHandler($e);
         }
         $e = new ErrorException($message, 0, $severity, $file, $line);
         $e->context = $context;
         throw $e;
     } elseif (($severity & error_reporting()) !== $severity) {
         return FALSE;
         // calls normal error handler to fill-in error_get_last()
     } elseif (self::$productionMode && ($severity & self::$logSeverity) === $severity) {
         $e = new ErrorException($message, 0, $severity, $file, $line);
         $e->context = $context;
         Helpers::improveException($e);
         try {
             self::log($e, self::ERROR);
         } catch (\Throwable $e) {
         } catch (\Exception $foo) {
         }
         return NULL;
     } elseif (!self::$productionMode && !isset($_GET['_tracy_skip_error']) && (is_bool(self::$strictMode) ? self::$strictMode : (self::$strictMode & $severity) === $severity)) {
         $e = new ErrorException($message, 0, $severity, $file, $line);
         $e->context = $context;
         $e->skippable = TRUE;
         self::exceptionHandler($e);
     }
     $message = 'PHP ' . Helpers::errorTypeToString($severity) . ": {$message}";
     $count =& self::getBar()->getPanel('Tracy:errors')->data["{$file}|{$line}|{$message}"];
     if ($count++) {
         // repeated error
         return NULL;
     } elseif (self::$productionMode) {
         try {
             self::log("{$message} in {$file}:{$line}", self::ERROR);
         } catch (\Throwable $e) {
         } catch (\Exception $foo) {
         }
         return NULL;
     } else {
         self::fireLog(new ErrorException($message, 0, $severity, $file, $line));
         return Helpers::isHtmlMode() || Helpers::isAjax() ? NULL : FALSE;
         // FALSE calls normal error handler
     }
 }
开发者ID:assad2012,项目名称:My_CodeIgniter,代码行数:58,代码来源:Debugger.php


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