MediaWiki  1.28.0
MWExceptionRenderer Class Reference

Class to expose exceptions to the client (API bots, users, admins using CLI scripts) More...

Static Public Member Functions

static getHTML ($e)
 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...
 
static output ($e, $mode, $eNew=null)
 
static runHooks ($e, $name, $args=[])
 Run hook to allow extensions to modify the text of the exception. More...
 

Public Attributes

const AS_PRETTY = 2
 
const AS_RAW = 1
 

Static Private Member Functions

static getShowBacktraceError ($e)
 
static getText ($e)
 
static googleSearchForm ()
 
static header ($header)
 
static isCommandLine ()
 
static msg ($key, $fallback)
 Get a message from i18n. More...
 
static printError ($message)
 Print a message, if possible to STDERR. More...
 
static reportHTML ($e)
 Output the exception report using HTML. More...
 
static reportOutageHTML ($e)
 
static showBackTrace ($e)
 
static statusHeader ($code)
 
static useOutputPage ($e)
 

Detailed Description

Class to expose exceptions to the client (API bots, users, admins using CLI scripts)

Since
1.28

Definition at line 26 of file MWExceptionRenderer.php.

Member Function Documentation

static MWExceptionRenderer::getHTML (   $e)
static

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.

Parameters
Exception | Throwable$e
Returns
string Html to output

Definition at line 210 of file MWExceptionRenderer.php.

References $e, $html, MWExceptionHandler\getLogMessage(), MWExceptionHandler\getRedactedTraceAsString(), WebRequest\getRequestId(), and MWExceptionHandler\getURL().

Referenced by MediaWiki\run().

static MWExceptionRenderer::getShowBacktraceError (   $e)
staticprivate
Parameters
Exception | Throwable$e
Returns
string

Definition at line 283 of file MWExceptionRenderer.php.

References $e, $vars, and global.

static MWExceptionRenderer::getText (   $e)
staticprivate
Parameters
Exception | Throwable$e
Returns
string

Definition at line 256 of file MWExceptionRenderer.php.

References $e, MWExceptionHandler\getLogMessage(), and MWExceptionHandler\getRedactedTraceAsString().

static MWExceptionRenderer::googleSearchForm ( )
staticprivate
Returns
string

Definition at line 384 of file MWExceptionRenderer.php.

References $wgCanonicalServer, $wgRequest, $wgSitename, form, global, name, style, and type.

static MWExceptionRenderer::header (   $header)
staticprivate
Parameters
string$header

Definition at line 306 of file MWExceptionRenderer.php.

References $header.

static MWExceptionRenderer::isCommandLine ( )
staticprivate
Returns
bool

Definition at line 299 of file MWExceptionRenderer.php.

References $GLOBALS.

static MWExceptionRenderer::msg (   $key,
  $fallback 
)
staticprivate

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 243 of file MWExceptionRenderer.php.

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

static MWExceptionRenderer::output (   $e,
  $mode,
  $eNew = null 
)
static
Parameters
Exception | Throwable$eOriginal exception
integer$modeMWExceptionExposer::AS_* constant
Exception | Throwable | null$eNewNew exception from attempting to show the first

Definition at line 35 of file MWExceptionRenderer.php.

References $e, $wgMimeType, MWExceptionHandler\getLogMessage(), MWExceptionHandler\getPublicLogMessage(), MWExceptionHandler\getRedactedTraceAsString(), global, and wfHttpError().

Referenced by MWExceptionHandler\report().

static MWExceptionRenderer::printError (   $message)
staticprivate

Print a message, if possible to STDERR.

Use this in command line mode only (see isCommandLine)

Parameters
string$messageFailure text

Definition at line 327 of file MWExceptionRenderer.php.

static MWExceptionRenderer::reportHTML (   $e)
staticprivate

Output the exception report using HTML.

Parameters
Exception | Throwable$e

Definition at line 153 of file MWExceptionRenderer.php.

References $e, $wgOut, $wgSitename, global, and Message\newFromSpecifier().

static MWExceptionRenderer::reportOutageHTML (   $e)
staticprivate
Parameters
Exception | Throwable$e

Definition at line 341 of file MWExceptionRenderer.php.

References $e, $html, Html\element(), global, and MessageCache\singleton().

static MWExceptionRenderer::runHooks (   $e,
  $name,
  $args = [] 
)
static

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

Called by MWException for b/c

Parameters
Exception | Throwable$e
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 94 of file MWExceptionRenderer.php.

References $args, $e, $name, as, and global.

Referenced by MWException\runHooks().

static MWExceptionRenderer::showBackTrace (   $e)
staticprivate
Parameters
Exception | Throwable$e
Returns
bool

Definition at line 270 of file MWExceptionRenderer.php.

References $e, and global.

static MWExceptionRenderer::statusHeader (   $code)
staticprivate
Parameters
integer$code

Definition at line 315 of file MWExceptionRenderer.php.

References $code, and HttpStatus\header().

static MWExceptionRenderer::useOutputPage (   $e)
staticprivate
Parameters
Exception | Throwable$e
Returns
bool Should the exception use $wgOut to output the error?

Definition at line 133 of file MWExceptionRenderer.php.

References $e, $GLOBALS, and as.

Member Data Documentation

const MWExceptionRenderer::AS_PRETTY = 2

Definition at line 28 of file MWExceptionRenderer.php.

Referenced by MWExceptionHandler\report().

const MWExceptionRenderer::AS_RAW = 1

Definition at line 27 of file MWExceptionRenderer.php.

Referenced by MWExceptionHandler\report().


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