MediaWiki  1.28.0
HttpError Class Reference

Show an error that looks like an HTTP server error. More...

Inheritance diagram for HttpError:
Collaboration diagram for HttpError:

Public Member Functions

 __construct ($httpCode, $content, $header=null)
 Constructor. More...
 
 getHTML ()
 Returns HTML for reporting the HTTP error. More...
 
 getStatusCode ()
 Returns the HTTP status code supplied to the constructor. More...
 
 isLoggable ()
 We don't want the default exception logging as we got our own logging set up in self::report. More...
 
 report ()
 Report and log the HTTP error. More...
 
- Public Member Functions inherited from MWException
 getHTML ()
 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...
 
 getPageTitle ()
 Return the title of the page when reporting this error in a HTTP response. More...
 
 getText ()
 Get the text to display when reporting the error on the command line. More...
 
 isLoggable ()
 Whether to log this exception in the exception debug log. More...
 
 msg ($key, $fallback)
 Get a message from i18n. More...
 
 report ()
 Output a report about the exception and takes care of formatting. More...
 
 reportHTML ()
 Output the exception report using HTML. More...
 
 runHooks ($name, $args=[])
 Run hook to allow extensions to modify the text of the exception. More...
 
 useMessageCache ()
 Can the extension use the Message class/wfMessage to get i18n-ed messages? More...
 
 useOutputPage ()
 Should the exception use $wgOut to output the error? More...
 

Public Attributes

 $content
 
 $header
 

Private Member Functions

 doLog ()
 

Private Attributes

 $httpCode
 

Additional Inherited Members

- Static Public Member Functions inherited from MWException
static isCommandLine ()
 Check whether we are in command line mode or not to report the exception in the correct format. More...
 

Detailed Description

Show an error that looks like an HTTP server error.

Replacement for wfHttpError().

Since
1.19

Definition at line 30 of file HttpError.php.

Constructor & Destructor Documentation

HttpError::__construct (   $httpCode,
  $content,
  $header = null 
)

Constructor.

Parameters
int$httpCodeHTTP status code to send to the client
string | Message$contentContent of the message
string | Message | null$headerContent of the header (\<title\> and \<h1\>)

Definition at line 40 of file HttpError.php.

References $content, $header, $httpCode, content, and MWException\header().

Member Function Documentation

HttpError::doLog ( )
private

Definition at line 83 of file HttpError.php.

References $content, $context, $httpCode, and getStatusCode().

Referenced by report().

HttpError::getHTML ( )

Returns HTML for reporting the HTTP error.

This will be a minimal but complete HTML document.

Returns
string HTML

Definition at line 112 of file HttpError.php.

References content, HttpStatus\getMessage(), and MWException\header().

Referenced by report().

HttpError::getStatusCode ( )

Returns the HTTP status code supplied to the constructor.

Returns
int

Definition at line 65 of file HttpError.php.

References $httpCode.

Referenced by doLog().

HttpError::isLoggable ( )

We don't want the default exception logging as we got our own logging set up in self::report.

See also
MWException::isLoggable
Since
1.24
Returns
bool

Definition at line 56 of file HttpError.php.

HttpError::report ( )

Report and log the HTTP error.

Sends the appropriate HTTP status code and outputs an HTML page with an error message.

Definition at line 74 of file HttpError.php.

References doLog(), getHTML(), HttpStatus\header(), MWException\header(), and print.

Member Data Documentation

HttpError::$content

Definition at line 31 of file HttpError.php.

Referenced by __construct(), and doLog().

HttpError::$header

Definition at line 31 of file HttpError.php.

Referenced by __construct().

HttpError::$httpCode
private

Definition at line 31 of file HttpError.php.

Referenced by __construct(), doLog(), and getStatusCode().


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