MediaWiki master
MWException Class Reference

MediaWiki exception. More...

Inherits Exception.

Inherited by ApiUsageException, ErrorPageError, FatalError, HttpError, MWContentSerializationException, and MediaWiki\Installer\InstallException.

Collaboration diagram for MWException:

Public Member Functions

 getHTML ()
 Format an HTML message for the current exception object.
 
 getPageTitle ()
 Return the title of the page when reporting this error in a HTTP response.
 
 getText ()
 Format plain text message for the current exception object.
 
 hasOverriddenHandler ()
 
 isLoggable ()
 Whether to log this exception in the exception debug log.
 
 msg ( $key, $fallback,... $params)
 Get a message from i18n.
 
 report ()
 Output a report about the exception and takes care of formatting.
 
 reportHTML ()
 Output the exception report using HTML.
 
 useMessageCache ()
 Can the extension use the Message class/wfMessage to get i18n-ed messages?
 

Static Public Member Functions

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

Detailed Description

MediaWiki exception.

Stability: newable
Stability: stable
to extend
Deprecated:
since 1.40, use native exceptions instead (either directly, or defining subclasses when appropriate)

Definition at line 33 of file MWException.php.

Member Function Documentation

◆ getHTML()

MWException::getHTML ( )

Format an HTML message for the current exception object.

Deprecated:
since 1.42 Provide the error message when constructing the Exception instead. If you need a whole custom error page, use ErrorPageError instead.
Returns
string HTML to output

Reimplemented in FatalError, and HttpError.

Definition at line 113 of file MWException.php.

References msg(), and wfDeprecated().

Referenced by reportHTML().

◆ getPageTitle()

MWException::getPageTitle ( )

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

Deprecated:
since 1.42 Provide the error message when constructing the Exception instead. If you need a whole custom error page, use ErrorPageError instead.
Returns
string

Definition at line 165 of file MWException.php.

References msg(), and wfDeprecated().

Referenced by reportHTML().

◆ getText()

MWException::getText ( )

Format plain text message for the current exception object.

Deprecated:
since 1.42 Provide the error message when constructing the Exception instead. If you need a whole custom error page, use ErrorPageError instead.
Returns
string

Reimplemented in FatalError.

Definition at line 147 of file MWException.php.

References wfDeprecated().

Referenced by MediaWiki\Installer\DatabaseInstaller\doUpgrade(), and report().

◆ hasOverriddenHandler()

MWException::hasOverriddenHandler ( )
final
Access: internal

Definition at line 232 of file MWException.php.

Referenced by MWExceptionHandler\report().

◆ isCommandLine()

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 271 of file MWException.php.

References MW_ENTRY_POINT.

◆ isLoggable()

MWException::isLoggable ( )

Whether to log this exception in the exception debug log.

Stability: stable
to override
Since
1.23
Returns
bool

Reimplemented in HttpError.

Definition at line 57 of file MWException.php.

◆ msg()

MWException::msg (   $key,
  $fallback,
  $params 
)

Get a message from i18n.

Parameters
string$keyMessage name
string$fallbackDefault message if the message cache can't be called by the exception
mixed...$params To pass to wfMessage()
Returns
string Message with arguments replaced

Definition at line 86 of file MWException.php.

References $fallback, $params, useMessageCache(), wfMessage(), and wfMsgReplaceArgs().

Referenced by ErrorPageError\__construct(), getHTML(), ErrorPageError\getMessageObject(), getPageTitle(), ErrorPageError\report(), UserNotLoggedIn\report(), and reportHTML().

◆ report()

MWException::report ( )

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

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

Stability: stable
to override

Reimplemented in HttpError.

Definition at line 215 of file MWException.php.

References getText(), and reportHTML().

◆ reportHTML()

MWException::reportHTML ( )

Output the exception report using HTML.

Deprecated:
since 1.42 Provide the error message when constructing the Exception instead. If you need a whole custom error page, use ErrorPageError instead.

Definition at line 175 of file MWException.php.

References $wgOut, getHTML(), getPageTitle(), msg(), and wfDeprecated().

Referenced by report().

◆ useMessageCache()

MWException::useMessageCache ( )

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

Stability: stable
to override
Returns
bool

Definition at line 68 of file MWException.php.

Referenced by msg().


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