[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/exception/ -> MWExceptionHandler.php (summary)

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

File Size: 372 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

MWExceptionHandler:: (12 methods):
  installHandler()
  report()
  printError()
  rollbackMasterChangesAndLog()
  handle()
  getRedactedTraceAsString()
  getRedactedTrace()
  getLogId()
  getURL()
  getLogMessage()
  jsonSerializeException()
  logException()


Class: MWExceptionHandler  - X-Ref

Handler class for MWExceptions

installHandler()   X-Ref
Install an exception handler for MediaWiki exception types.


report( Exception $e )   X-Ref
Report an exception to the user

param: Exception $e

printError( $message )   X-Ref
Print a message, if possible to STDERR.
Use this in command line mode only (see isCommandLine)

param: string $message Failure text

rollbackMasterChangesAndLog( Exception $e )   X-Ref
If there are any open database transactions, roll them back and log
the stack trace of the exception that should have been caught so the
transaction could be aborted properly.

param: Exception $e

handle( $e )   X-Ref
Exception handler which simulates the appropriate catch() handling:

try {
...
} catch ( MWException $e ) {
$e->report();
} catch ( Exception $e ) {
echo $e->__toString();
}
param: Exception $e

getRedactedTraceAsString( Exception $e )   X-Ref
Generate a string representation of an exception's stack trace

Like Exception::getTraceAsString, but replaces argument values with
argument type or class name.

param: Exception $e
return: string

getRedactedTrace( Exception $e )   X-Ref
Return a copy of an exception's backtrace as an array.

Like Exception::getTrace, but replaces each element in each frame's
argument array with the name of its class (if the element is an object)
or its type (if the element is a PHP primitive).

param: Exception $e
return: array

getLogId( Exception $e )   X-Ref
Get the ID for this error.

The ID is saved so that one can match the one output to the user (when
$wgShowExceptionDetails is set to false), to the entry in the debug log.

param: Exception $e
return: string

getURL()   X-Ref
If the exception occurred in the course of responding to a request,
returns the requested URL. Otherwise, returns false.

return: string|bool

getLogMessage( Exception $e )   X-Ref
Return the requested URL and point to file and line number from which the
exception occurred.

param: Exception $e
return: string

jsonSerializeException( Exception $e, $pretty = false, $escaping = 0 )   X-Ref
Serialize an Exception object to JSON.

The JSON object will have keys 'id', 'file', 'line', 'message', and
'url'. These keys map to string values, with the exception of 'line',
which is a number, and 'url', which may be either a string URL or or
null if the exception did not occur in the context of serving a web
request.

If $wgLogExceptionBacktrace is true, it will also have a 'backtrace'
key, mapped to the array return value of Exception::getTrace, but with
each element in each frame's "args" array (if set) replaced with the
argument's class name (if the argument is an object) or type name (if
the argument is a PHP primitive).

param: Exception $e
param: bool $pretty Add non-significant whitespace to improve readability (default: false).
param: int $escaping Bitfield consisting of FormatJson::.*_OK class constants.
return: string|bool JSON string if successful; false upon failure

logException( Exception $e )   X-Ref
Log an exception to the exception log (if enabled).

This method must not assume the exception is an MWException,
it is also used to handle PHP errors or errors from other libraries.

param: Exception $e



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1