37 !empty( $GLOBALS[
'wgFullyInitialised'] ) &&
38 !empty( $GLOBALS[
'wgOut'] ) &&
39 !defined(
'MEDIAWIKI_INSTALL' ) &&
64 foreach ( $this->getTrace() as $frame ) {
65 if ( isset( $frame[
'class'] ) && $frame[
'class'] === LocalisationCache::class ) {
87 }
catch ( Exception $e ) {
90 if (
$res ===
false ) {
95 '{{SITENAME}}' =>
'MediaWiki',
114 return '<p>' . nl2br( htmlspecialchars( MWExceptionHandler::getLogMessage( $this ) ) ) .
115 '</p><p>Backtrace:</p><p>' .
116 nl2br( htmlspecialchars( MWExceptionHandler::getRedactedTraceAsString( $this ) ) ) .
119 $logId = WebRequest::getRequestId();
120 $type = static::class;
121 return Html::errorBox(
123 '[' . $logId .
'] ' .
124 gmdate(
'Y-m-d H:i:s' ) .
": " .
125 $this->
msg(
"internalerror-fatal-exception",
126 "Fatal exception of type $1",
129 MWExceptionHandler::getURL()
132 "<!-- Set \$wgShowExceptionDetails = true; " .
133 "at the bottom of LocalSettings.php to show detailed " .
134 "debugging information. -->";
151 return MWExceptionHandler::getLogMessage( $this ) .
152 "\nBacktrace:\n" . MWExceptionHandler::getRedactedTraceAsString( $this ) .
"\n";
154 return "Set \$wgShowExceptionDetails = true; " .
155 "in LocalSettings.php to show detailed debugging information.\n";
167 return $this->
msg(
'internalerror',
'Internal error' );
189 self::header(
'Content-Type: text/html; charset=UTF-8' );
190 echo
"<!DOCTYPE html>\n" .
194 htmlspecialchars( $this->
msg(
'pagetitle',
'$1 - MediaWiki', $this->
getPageTitle() ) ) .
196 '<style>body { font-family: sans-serif; margin: 0; padding: 0.5em 2em; }</style>' .
201 echo
"</body></html>\n";
212 if ( defined(
'MW_API' ) ) {
213 self::header(
'MediaWiki-API-Error: internal_api_error_' . static::class );
216 if ( self::isCommandLine() ) {
220 self::statusHeader( 500 );
233 if ( !defined(
'MW_PHPUNIT_TEST' ) && defined(
'STDERR' ) ) {
234 fwrite( STDERR, $message );
247 return !empty( $GLOBALS[
'wgCommandLineMode'] );
256 if ( !headers_sent() ) {
262 if ( !headers_sent() ) {
263 HttpStatus::header( $code );
$wgShowExceptionDetails
If set to true, uncaught exceptions will print the exception message and a complete stack trace to ou...
wfMsgReplaceArgs( $message, $args)
Replace message parameter keys on the given formatted output.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
if(!defined( 'MW_NO_SESSION') &&! $wgCommandLineMode) $wgOut
writeToCommandLine( $message)
Write a message to stderr falling back to stdout if stderr unavailable.
static statusHeader( $code)
isLoggable()
Whether to log this exception in the exception debug log.
useMessageCache()
Can the extension use the Message class/wfMessage to get i18n-ed messages?
msg( $key, $fallback,... $params)
Get a message from i18n.
static header( $header)
Send a header, if we haven't already sent them.
getHTML()
If $wgShowExceptionDetails is true, return a HTML message with a backtrace to the error,...
static isCommandLine()
Check whether we are in command line mode or not to report the exception in the correct format.
useOutputPage()
Should the exception use $wgOut to output the error?
report()
Output a report about the exception and takes care of formatting.
getPageTitle()
Return the title of the page when reporting this error in a HTTP response.
reportHTML()
Output the exception report using HTML.
getText()
Get the text to display when reporting the error on the command line.