MediaWiki  REL1_22
MWExceptionHandler Class Reference

Handler class for MWExceptions. More...

List of all members.

Static Public Member Functions

static getLogId (Exception $e)
 Get the ID for this error.
static getLogMessage (Exception $e)
 Return the requested URL and point to file and line number from which the exception occurred.
static getRedactedTrace (Exception $e)
 Return a copy of an exception's backtrace as an array.
static getRedactedTraceAsString (Exception $e)
 Generate a string representation of an exception's stack trace.
static handle ($e)
 Exception handler which simulates the appropriate catch() handling:
static installHandler ()
 Install an exception handler for MediaWiki exception types.
static logException (Exception $e)
 Log an exception to the exception log (if enabled).
static printError ($message)
 Print a message, if possible to STDERR.

Static Protected Member Functions

static report (Exception $e)
 Report an exception to the user.

Detailed Description

Handler class for MWExceptions.

Definition at line 587 of file Exception.php.


Member Function Documentation

static MWExceptionHandler::getLogId ( Exception $  e) [static]

Get the ID for this error.

The ID is saved so that one can match the one output to the user (when $wgShowExceptionDetails is set to false), to the entry in the debug log.

Since:
1.22
Parameters:
Exception$e
Returns:
string

Definition at line 767 of file Exception.php.

References wfRandomString().

Referenced by getLogMessage().

static MWExceptionHandler::getLogMessage ( Exception $  e) [static]

Return the requested URL and point to file and line number from which the exception occurred.

Since:
1.22
Parameters:
Exception$e
Returns:
string

Definition at line 782 of file Exception.php.

References $file, getLogId(), and global.

Referenced by MWException\getHTML(), logException(), and report().

static MWExceptionHandler::getRedactedTrace ( Exception $  e) [static]

Return a copy of an exception's backtrace as an array.

Like Exception::getTrace, but replaces each element in each frame's argument array with the name of its class (if the element is an object) or its type (if the element is a PHP primitive).

Since:
1.22
Parameters:
Exception$e
Returns:
array

Definition at line 745 of file Exception.php.

Referenced by MWExceptionHandlerTest\testGetRedactedTrace().

static MWExceptionHandler::getRedactedTraceAsString ( Exception $  e) [static]

Generate a string representation of an exception's stack trace.

Like Exception::getTraceAsString, but replaces argument values with argument type or class name.

Parameters:
Exception$e
Returns:
string

Definition at line 702 of file Exception.php.

References as.

Referenced by MWException\getHTML(), MWException\getText(), and report().

static MWExceptionHandler::handle ( e) [static]

Exception handler which simulates the appropriate catch() handling:

try { ... } catch ( MWException $e ) { $e->report(); } catch ( Exception $e ) { echo $e->__toString(); }

Definition at line 675 of file Exception.php.

References $wgFullyInitialised, global, report(), and wfLogProfilingData().

Install an exception handler for MediaWiki exception types.

Definition at line 591 of file Exception.php.

References array().

static MWExceptionHandler::logException ( Exception $  e) [static]

Log an exception to the exception log (if enabled).

This method must not assume the exception is an MWException, it is also used to handle PHP errors or errors from other libraries.

Since:
1.22
Parameters:
Exception$e

Definition at line 811 of file Exception.php.

References getLogMessage(), global, and wfDebugLog().

Referenced by DeferredUpdates\doUpdates(), and MWException\report().

static MWExceptionHandler::printError ( message) [static]

Print a message, if possible to STDERR.

Use this in command line mode only (see isCommandLine)

Parameters:
string$messageFailure text

Definition at line 654 of file Exception.php.

Referenced by MWException\report(), and report().

static MWExceptionHandler::report ( Exception $  e) [static, protected]

Report an exception to the user.

Definition at line 598 of file Exception.php.

References getLogMessage(), getRedactedTraceAsString(), global, MWException\isCommandLine(), and printError().

Referenced by handle().


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