本文整理汇总了PHP中MWExceptionHandler::getPublicLogMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP MWExceptionHandler::getPublicLogMessage方法的具体用法?PHP MWExceptionHandler::getPublicLogMessage怎么用?PHP MWExceptionHandler::getPublicLogMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWExceptionHandler
的用法示例。
在下文中一共展示了MWExceptionHandler::getPublicLogMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output
/**
* @param Exception|Throwable $e Original exception
* @param integer $mode MWExceptionExposer::AS_* constant
* @param Exception|Throwable|null $eNew New exception from attempting to show the first
*/
public static function output($e, $mode, $eNew = null)
{
global $wgMimeType;
if (defined('MW_API')) {
// Unhandled API exception, we can't be sure that format printer is alive
self::header('MediaWiki-API-Error: internal_api_error_' . get_class($e));
wfHttpError(500, 'Internal Server Error', self::getText($e));
} elseif (self::isCommandLine()) {
self::printError(self::getText($e));
} elseif ($mode === self::AS_PRETTY) {
if ($e instanceof DBConnectionError) {
self::reportOutageHTML($e);
} else {
self::statusHeader(500);
self::header("Content-Type: {$wgMimeType}; charset=utf-8");
self::reportHTML($e);
}
} else {
if ($eNew) {
$message = "MediaWiki internal error.\n\n";
if (self::showBackTrace($e)) {
$message .= 'Original exception: ' . MWExceptionHandler::getLogMessage($e) . "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString($e) . "\n\nException caught inside exception handler: " . MWExceptionHandler::getLogMessage($eNew) . "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString($eNew);
} else {
$message .= "Exception caught inside exception handler.\n\n" . "Set \$wgShowExceptionDetails = true; at the bottom of LocalSettings.php " . "to show detailed debugging information.";
}
$message .= "\n";
} else {
if (self::showBackTrace($e)) {
$message = MWExceptionHandler::getLogMessage($e) . "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString($e) . "\n";
} else {
$message = MWExceptionHandler::getPublicLogMessage($e);
}
}
if (self::isCommandLine()) {
self::printError($message);
} else {
echo nl2br(htmlspecialchars($message)) . "\n";
}
}
}
示例2: formatExceptionNoComment
/**
* Handle exception display.
*
* @since 1.25
* @param Exception $e Exception to be shown to the user
* @return string Sanitized text that can be returned to the user
*/
protected static function formatExceptionNoComment($e)
{
global $wgShowExceptionDetails;
if (!$wgShowExceptionDetails) {
return MWExceptionHandler::getPublicLogMessage($e);
}
return MWExceptionHandler::getLogMessage($e);
}