MediaWiki  master
MWExceptionRenderer Class Reference

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

Static Public Member Functions

static getHTML (Throwable $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 (Throwable $e, $mode, Throwable $eNew=null)
 

Public Attributes

const AS_PRETTY = 2
 
const AS_RAW = 1
 

Static Private Member Functions

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

Detailed Description

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

Since
1.28

Definition at line 31 of file MWExceptionRenderer.php.

Member Function Documentation

◆ getHTML()

static MWExceptionRenderer::getHTML ( Throwable  $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
Throwable$e
Returns
string Html to output

Definition at line 180 of file MWExceptionRenderer.php.

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

Referenced by reportHTML(), and MediaWiki\run().

◆ getShowBacktraceError()

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

Definition at line 253 of file MWExceptionRenderer.php.

Referenced by getText(), and output().

◆ getText()

static MWExceptionRenderer::getText ( Throwable  $e)
staticprivate

◆ header()

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

Definition at line 268 of file MWExceptionRenderer.php.

References $header.

Referenced by output(), and reportHTML().

◆ isCommandLine()

static MWExceptionRenderer::isCommandLine ( )
staticprivate
Returns
bool

Definition at line 261 of file MWExceptionRenderer.php.

References $GLOBALS.

◆ msg()

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

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

References $fallback, $res, $wgSitename, wfMessage(), and wfMsgReplaceArgs().

Referenced by reportHTML().

◆ output()

static MWExceptionRenderer::output ( Throwable  $e,
  $mode,
Throwable  $eNew = null 
)
static

◆ printError()

static MWExceptionRenderer::printError (   $message)
staticprivate

Print a message, if possible to STDERR.

Use this in command line mode only (see isCommandLine)

SecurityCheck-XSS

Parameters
string$messageFailure text

Definition at line 290 of file MWExceptionRenderer.php.

Referenced by output().

◆ reportHTML()

static MWExceptionRenderer::reportHTML ( Throwable  $e)
staticprivate

Output the throwable report using HTML.

Parameters
Throwable$e

Definition at line 133 of file MWExceptionRenderer.php.

References $wgOut, $wgSitename, Html\element(), getHTML(), header(), msg(), and Message\newFromSpecifier().

Referenced by output().

◆ reportOutageHTML()

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

Definition at line 304 of file MWExceptionRenderer.php.

References $wgShowExceptionDetails, $wgShowHostnames, $wgSitename, and Html\element().

Referenced by output().

◆ statusHeader()

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

Definition at line 277 of file MWExceptionRenderer.php.

References HttpStatus\header().

Referenced by output().

◆ useOutputPage()

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

Definition at line 106 of file MWExceptionRenderer.php.

References $GLOBALS, RequestContext\getMain(), and getTitle().

Member Data Documentation

◆ AS_PRETTY

◆ AS_RAW

const MWExceptionRenderer::AS_RAW = 1

Definition at line 32 of file MWExceptionRenderer.php.

Referenced by MWExceptionHandler\report().


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