/** * If $wgShowExceptionDetails is true, return a HTML message with a * backtrace to the error, otherwise show a message to ask to set it to true * to show that information. * * @return string Html to output */ public function getHTML() { global $wgShowExceptionDetails; if ($wgShowExceptionDetails) { return '<p>' . nl2br(htmlspecialchars(MWExceptionHandler::getLogMessage($this))) . '</p><p>Backtrace:</p><p>' . nl2br(htmlspecialchars(MWExceptionHandler::getRedactedTraceAsString($this))) . "</p>\n"; } else { $logId = MWExceptionHandler::getLogId($this); $type = get_class($this); return "<div class=\"errorbox\">" . '[' . $logId . '] ' . gmdate('Y-m-d H:i:s') . ": " . $this->msg("internalerror-fatal-exception", "Fatal exception of type \$1", $type, $logId, MWExceptionHandler::getURL($this)) . "</div>\n" . "<!-- Set \$wgShowExceptionDetails = true; " . "at the bottom of LocalSettings.php to show detailed " . "debugging information. -->"; } }
/** * If $wgShowExceptionDetails is true, return a HTML message with a * backtrace to the error, otherwise show a message to ask to set it to true * to show that information. * * @param Exception|Throwable $e * @return string Html to output */ public static function getHTML($e) { if (self::showBackTrace($e)) { $html = "<div class=\"errorbox\"><p>" . nl2br(htmlspecialchars(MWExceptionHandler::getLogMessage($e))) . '</p><p>Backtrace:</p><p>' . nl2br(htmlspecialchars(MWExceptionHandler::getRedactedTraceAsString($e))) . "</p></div>\n"; } else { $logId = WebRequest::getRequestId(); $html = "<div class=\"errorbox\">" . '[' . $logId . '] ' . gmdate('Y-m-d H:i:s') . ": " . self::msg("internalerror-fatal-exception", "Fatal exception of type \$1", get_class($e), $logId, MWExceptionHandler::getURL()) . "</div>\n" . "<!-- Set \$wgShowExceptionDetails = true; " . "at the bottom of LocalSettings.php to show detailed " . "debugging information. -->"; } return $html; }