MediaWiki  1.28.0
MWException Class Reference

MediaWiki exception. More...

Inheritance diagram for MWException:
Collaboration diagram for MWException:

Public Member Functions

 getHTML ()
 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. More...
 
 getPageTitle ()
 Return the title of the page when reporting this error in a HTTP response. More...
 
 getText ()
 Get the text to display when reporting the error on the command line. More...
 
 isLoggable ()
 Whether to log this exception in the exception debug log. More...
 
 msg ($key, $fallback)
 Get a message from i18n. More...
 
 report ()
 Output a report about the exception and takes care of formatting. More...
 
 reportHTML ()
 Output the exception report using HTML. More...
 
 runHooks ($name, $args=[])
 Run hook to allow extensions to modify the text of the exception. More...
 
 useMessageCache ()
 Can the extension use the Message class/wfMessage to get i18n-ed messages? More...
 
 useOutputPage ()
 Should the exception use $wgOut to output the error? More...
 

Static Public Member Functions

static isCommandLine ()
 Check whether we are in command line mode or not to report the exception in the correct format. More...
 

Static Private Member Functions

static header ($header)
 Send a header, if we haven't already sent them. More...
 
static statusHeader ($code)
 

Detailed Description

MediaWiki exception.

Definition at line 26 of file MWException.php.

Member Function Documentation

MWException::getHTML ( )

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.

Returns
string Html to output

Definition at line 105 of file MWException.php.

References $type, MWExceptionHandler\getLogMessage(), MWExceptionHandler\getRedactedTraceAsString(), WebRequest\getRequestId(), MWExceptionHandler\getURL(), global, and msg().

Referenced by reportHTML(), and wfStreamThumb().

MWException::getPageTitle ( )

Return the title of the page when reporting this error in a HTTP response.

Returns
string

Definition at line 155 of file MWException.php.

References msg().

Referenced by reportHTML().

MWException::getText ( )

Get the text to display when reporting the error on the command line.

If $wgShowExceptionDetails is true, return a text message with a backtrace to the error.

Returns
string

Definition at line 138 of file MWException.php.

References MWExceptionHandler\getLogMessage(), MWExceptionHandler\getRedactedTraceAsString(), and global.

Referenced by DatabaseInstaller\doUpgrade(), ChangePassword\execute(), CreateAndPromote\execute(), and report().

static MWException::header (   $header)
staticprivate

Send a header, if we haven't already sent them.

We shouldn't, but sometimes we might in a weird case like Export

Parameters
string$header

Definition at line 239 of file MWException.php.

References $header.

Referenced by HttpError\__construct(), HttpError\getHTML(), and HttpError\report().

static MWException::isCommandLine ( )
static

Check whether we are in command line mode or not to report the exception in the correct format.

Returns
bool

Definition at line 230 of file MWException.php.

References $GLOBALS.

MWException::isLoggable ( )

Whether to log this exception in the exception debug log.

Since
1.23
Returns
bool

Definition at line 45 of file MWException.php.

MWException::msg (   $key,
  $fallback 
)

Get a message from i18n.

Parameters
string$keyMessage name
string$fallbackDefault message if the message cache can't be called by the exception The function also has other parameters that are arguments for the message
Returns
string Message with arguments replaced

Definition at line 86 of file MWException.php.

References $args, $e, $fallback, useMessageCache(), wfMessage(), and wfMsgReplaceArgs().

Referenced by ErrorPageError\__construct(), getHTML(), getPageTitle(), ErrorPageError\report(), UserNotLoggedIn\report(), reportHTML(), and MediaWiki\Auth\AuthPluginPrimaryAuthenticationProviderTest\testProviderChangeAuthenticationData().

MWException::report ( )

Output a report about the exception and takes care of formatting.

It will be either HTML or plain text based on isCommandLine().

Definition at line 201 of file MWException.php.

References $wgMimeType, getText(), global, reportHTML(), and wfHttpError().

MWException::reportHTML ( )

Output the exception report using HTML.

Definition at line 162 of file MWException.php.

References $wgOut, $wgSitename, getHTML(), getPageTitle(), global, msg(), runHooks(), and useOutputPage().

Referenced by report().

MWException::runHooks (   $name,
  $args = [] 
)

Run hook to allow extensions to modify the text of the exception.

Parameters
string$nameClass name of the exception
array$argsArguments to pass to the callback functions
Returns
string|null String to output or null if any hook has been called

Definition at line 73 of file MWException.php.

References $args, $name, and MWExceptionRenderer\runHooks().

Referenced by reportHTML().

static MWException::statusHeader (   $code)
staticprivate

Definition at line 244 of file MWException.php.

References $code, and HttpStatus\header().

MWException::useMessageCache ( )

Can the extension use the Message class/wfMessage to get i18n-ed messages?

Returns
bool

Definition at line 54 of file MWException.php.

References $wgLang, as, and global.

Referenced by msg(), and useOutputPage().

MWException::useOutputPage ( )

Should the exception use $wgOut to output the error?

Returns
bool

Definition at line 32 of file MWException.php.

References $GLOBALS, and useMessageCache().

Referenced by reportHTML().


The documentation for this class was generated from the following file: