MediaWiki REL1_37
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)
 
 getHTML ()
 Returns HTML for reporting the HTTP error.
 
 getStatusCode ()
 Returns the HTTP status code supplied to the constructor.
 
 isLoggable ()
 We don't want the default exception logging as we got our own logging set up in self::report.
 
 report ()
 Report and log the HTTP error.
 
- Public Member Functions inherited from MWException
 getPageTitle ()
 Return the title of the page when reporting this error in a HTTP response.
 
 getText ()
 Get the text to display when reporting the error on the command line.
 
 msg ( $key, $fallback,... $params)
 Get a message from i18n.
 
 reportHTML ()
 Output the exception report using HTML.
 
 useMessageCache ()
 Can the extension use the Message class/wfMessage to get i18n-ed messages?
 
 useOutputPage ()
 Should the exception use $wgOut to output the error?
 

Private Member Functions

 doLog ()
 

Private Attributes

string Message $content
 
string Message null $header
 
int $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.
 

Detailed Description

Show an error that looks like an HTTP server error.

Replacement for wfHttpError().

@newable

Stability: stable
to extend
Since
1.19

Definition at line 32 of file HttpError.php.

Constructor & Destructor Documentation

◆ __construct()

HttpError::__construct (   $httpCode,
  $content,
  $header = null 
)
Stability: stable
to call
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\>)
-taint$contenttainted
-taint$headertainted

Definition at line 48 of file HttpError.php.

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

Member Function Documentation

◆ doLog()

HttpError::doLog ( )
private

Definition at line 91 of file HttpError.php.

References $content, $httpCode, getFile(), getStatusCode(), and Message\text().

Referenced by report().

◆ getHTML()

HttpError::getHTML ( )

Returns HTML for reporting the HTTP error.

This will be a minimal but complete HTML document.

Returns
string HTML

Reimplemented from MWException.

Definition at line 120 of file HttpError.php.

References MWException\header().

Referenced by report().

◆ getStatusCode()

HttpError::getStatusCode ( )

Returns the HTTP status code supplied to the constructor.

Returns
int

Definition at line 73 of file HttpError.php.

References $httpCode.

Referenced by doLog().

◆ isLoggable()

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

Reimplemented from MWException.

Definition at line 64 of file HttpError.php.

◆ report()

HttpError::report ( )

Report and log the HTTP error.

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

Reimplemented from MWException.

Definition at line 82 of file HttpError.php.

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

Member Data Documentation

◆ $content

string Message HttpError::$content
private

Definition at line 38 of file HttpError.php.

Referenced by __construct(), and doLog().

◆ $header

string Message null HttpError::$header
private

Definition at line 36 of file HttpError.php.

Referenced by __construct().

◆ $httpCode

int HttpError::$httpCode
private

Definition at line 34 of file HttpError.php.

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


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