Go to the documentation of this file.
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 ) {
89 }
catch ( Exception $e ) {
92 if (
$res ===
false ) {
117 '</p><p>Backtrace:</p><p>' .
122 $type = static::class;
125 '[' . $logId .
'] ' .
126 gmdate(
'Y-m-d H:i:s' ) .
": " .
127 $this->
msg(
"internalerror-fatal-exception",
128 "Fatal exception of type $1",
134 "<!-- Set \$wgShowExceptionDetails = true; " .
135 "at the bottom of LocalSettings.php to show detailed " .
136 "debugging information. -->";
156 return "Set \$wgShowExceptionDetails = true; " .
157 "in LocalSettings.php to show detailed debugging information.\n";
169 return $this->
msg(
'internalerror',
'Internal error' );
183 $wgOut->setHTMLTitle(
191 $wgOut->addHTML( $this->
getHTML() );
195 self::header(
'Content-Type: text/html; charset=utf-8' );
196 echo
"<!DOCTYPE html>\n" .
200 htmlspecialchars( $this->
msg(
'pagetitle',
"$1 - $wgSitename", $this->
getPageTitle() ) ) .
202 '<style>body { font-family: sans-serif; margin: 0; padding: 0.5em 2em; }</style>' .
207 echo
"</body></html>\n";
220 if ( defined(
'MW_API' ) ) {
221 self::header(
'MediaWiki-API-Error: internal_api_error_' . static::class );
224 if ( self::isCommandLine() ) {
229 self::header(
"Content-Type: $wgMimeType; charset=utf-8" );
243 if ( !defined(
'MW_PHPUNIT_TEST' ) && defined(
'STDERR' ) ) {
244 fwrite( STDERR, $message );
257 return !empty( $GLOBALS[
'wgCommandLineMode'] );
266 if ( !headers_sent() ) {
272 if ( !headers_sent() ) {
$wgMimeType
The default Content-Type header.
wfMsgReplaceArgs( $message, $args)
Replace message parameter keys on the given formatted output.
wfMessage( $key,... $params)
This is the function for getting translated interface messages.
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?
static isCommandLine()
Check whether we are in command line mode or not to report the exception in the correct format.
static getRedactedTraceAsString(Throwable $e)
Generate a string representation of a throwable's stack trace.
getText()
Get the text to display when reporting the error on the command line.
static getURL()
If the exception occurred in the course of responding to a request, returns the requested URL.
getPageTitle()
Return the title of the page when reporting this error in a HTTP response.
getHTML()
If $wgShowExceptionDetails is true, return a HTML message with a backtrace to the error,...
static errorBox( $html, $heading='', $className='')
Return an error box.
report()
Output a report about the exception and takes care of formatting.
reportHTML()
Output the exception report using HTML.
$wgSitename
Name of the site.
msg( $key, $fallback,... $params)
Get a message from i18n.
static header( $header)
Send a header, if we haven't already sent them.
static header( $code)
Output an HTTP status code header.
static getRequestId()
Get the current request ID.
$wgShowExceptionDetails
If set to true, uncaught exceptions will print the exception message and a complete stack trace to ou...
writeToCommandLine( $message)
Write a message to stderr falling back to stdout if stderr unavailable.
static statusHeader( $code)
static getLogMessage(Throwable $e)
Get a message formatting the throwable message and its origin.
useOutputPage()
Should the exception use $wgOut to output the error?