本文整理汇总了PHP中Tracy\Helpers::errorTypeToString方法的典型用法代码示例。如果您正苦于以下问题:PHP Helpers::errorTypeToString方法的具体用法?PHP Helpers::errorTypeToString怎么用?PHP Helpers::errorTypeToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tracy\Helpers
的用法示例。
在下文中一共展示了Helpers::errorTypeToString方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: formatMessage
/**
* @author David Grudl
* @see https://github.com/nette/tracy
*/
protected static function formatMessage(Throwable $message) : string
{
$tmp = [];
while ($message) {
$tmp[] = ($message instanceof \ErrorException ? Helpers::errorTypeToString($message->getSeverity()) . ': ' . $message->getMessage() : Helpers::getClass($message) . ': ' . $message->getMessage()) . ' in ' . $message->getFile() . ':' . $message->getLine();
$message = $message->getPrevious();
}
$message = implode($tmp, "\ncaused by ");
return trim($message);
}
示例2: render
/**
* Renders blue screen.
* @param \Exception
* @return void
*/
public function render(\Exception $exception)
{
$panels = $this->panels;
$info = array_filter($this->info);
$source = Helpers::getSource();
$sourceIsUrl = preg_match('#^https?://#', $source);
$title = $exception instanceof \ErrorException ? Helpers::errorTypeToString($exception->getSeverity()) : get_class($exception);
$skipError = $sourceIsUrl && $exception instanceof \ErrorException && !empty($exception->skippable) ? $source . (strpos($source, '?') ? '&' : '?') . '_tracy_skip_error' : NULL;
require __DIR__ . '/templates/bluescreen.phtml';
}
示例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'] : 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;
try {
self::log($e, self::ERROR);
} 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 (\Exception $foo) {
}
return NULL;
} else {
self::fireLog(new ErrorException($message, 0, $severity, $file, $line));
return self::isHtmlMode() ? NULL : FALSE;
// FALSE calls normal error handler
}
}