MediaWiki master
MWException Class Reference

MediaWiki exception. More...

Inherits Exception.

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

Collaboration diagram for MWException:

Public Member Functions

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

Member Function Documentation

◆ hasOverriddenHandler()

MWException::hasOverriddenHandler ( )
final
Access: internal

Definition at line 109 of file MWException.php.

◆ 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 119 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 44 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 @phpcs:ignore Generic.Files.LineLength
MessageParam|MessageSpecifier|string|int|float|list<MessageParam|MessageSpecifier|string|int|float>...$params See Message::params()
Returns
string Message with arguments replaced

Definition at line 75 of file MWException.php.

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

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

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

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

Referenced by msg().


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