MediaWiki REL1_30
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.
 
static output ( $e, $mode, $eNew=null)
 

Public Attributes

const AS_PRETTY = 2
 
const AS_RAW = 1
 

Static Private Member Functions

static getShowBacktraceError ( $e)
 
static getText ( $e)
 
static header ( $header)
 
static isCommandLine ()
 
static msg ( $key, $fallback)
 Get a message from i18n.
 
static printError ( $message)
 Print a message, if possible to STDERR.
 
static reportHTML ( $e)
 Output the exception report using HTML.
 
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 30 of file MWExceptionRenderer.php.

Member Function Documentation

◆ getHTML()

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

References $e, and $html.

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

◆ getShowBacktraceError()

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

Definition at line 239 of file MWExceptionRenderer.php.

References $e, $vars, $wgShowDBErrorBacktrace, $wgShowExceptionDetails, and global.

Referenced by getText(), and output().

◆ getText()

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

Definition at line 212 of file MWExceptionRenderer.php.

References $e, and getShowBacktraceError().

◆ header()

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

Definition at line 262 of file MWExceptionRenderer.php.

References $header, and header().

Referenced by header(), output(), and reportHTML().

◆ isCommandLine()

static MWExceptionRenderer::isCommandLine ( )
staticprivate
Returns
bool

Definition at line 255 of file MWExceptionRenderer.php.

References $GLOBALS.

◆ msg()

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

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

Referenced by reportHTML().

◆ output()

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

Definition at line 39 of file MWExceptionRenderer.php.

References $e, $wgMimeType, getShowBacktraceError(), global, header(), printError(), reportHTML(), reportOutageHTML(), statusHeader(), and wfHttpError().

Referenced by MWExceptionHandler\report().

◆ printError()

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

Referenced by output().

◆ reportHTML()

static MWExceptionRenderer::reportHTML (   $e)
staticprivate

Output the exception report using HTML.

Parameters
Exception | Throwable$e

Definition at line 117 of file MWExceptionRenderer.php.

References $e, $wgOut, $wgSitename, getHTML(), global, header(), and msg().

Referenced by output().

◆ reportOutageHTML()

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

Definition at line 297 of file MWExceptionRenderer.php.

References $e, $html, $wgShowDBErrorBacktrace, $wgShowHostnames, $wgShowSQLErrors, $wgSitename, global, and MessageCache\singleton().

Referenced by output().

◆ showBackTrace()

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

Definition at line 226 of file MWExceptionRenderer.php.

References $e, $wgShowDBErrorBacktrace, $wgShowExceptionDetails, and global.

◆ statusHeader()

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

Definition at line 271 of file MWExceptionRenderer.php.

References $code, and HttpStatus\header().

Referenced by output().

◆ useOutputPage()

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

Definition at line 92 of file MWExceptionRenderer.php.

References $e, $GLOBALS, as, and RequestContext\getMain().

Member Data Documentation

◆ AS_PRETTY

const MWExceptionRenderer::AS_PRETTY = 2

Definition at line 32 of file MWExceptionRenderer.php.

Referenced by MWExceptionHandler\report().

◆ AS_RAW

const MWExceptionRenderer::AS_RAW = 1

Definition at line 31 of file MWExceptionRenderer.php.

Referenced by MWExceptionHandler\report().


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