Abstract Class JError

Description

Error Handling Class

This class is inspired in design and concept by patErrorManager <http://www.php-tools.net>

patErrorManager contributors include:

  • gERD Schaufelberger <gerd@php-tools.net>
  • Sebastian Mordziol <argh@php-tools.net>
  • Stephan Schmidt <scst@php-tools.net>

  • deprecated: 12.1 (Platform) & 4.0 (CMS) - Use PHP Exception
  • abstract:
  • since: 11.1

Located in /libraries/legacy/error/error.php (line 36)


	
			
Variable Summary
 static array $handlers
 static boolean $legacy
 static array $levels
 static array $stack
Method Summary
 static void addToStack (JException &$e)
 static void attachHandler ()
 static void customErrorHandler (integer $level, string $msg)
 static void customErrorPage (object &$error)
 static void detachHandler ()
 static mixed getError ([boolean $unset = false])
 static array getErrorHandling (integer $level)
 static array getErrors ()
 static object The handleCallback (object &$error, array $options)
 static object The handleDie (object &$error, array $options)
 static object The handleEcho (object &$error, array $options)
 static object The handleIgnore (object &$error, array $options)
 static object The handleLog (object &$error, array $options)
 static object The handleMessage (object &$error, array $options)
 static object The handleVerbose (object &$error, array $options)
 static boolean isError (mixed $object)
 static mixed raise (integer $level, string $code, string $msg, [mixed $info = null], [boolean $backtrace = false])
 static object raiseError (string $code, string $msg, [mixed $info = null])
 static object The raiseNotice (string $code, string $msg, [mixed $info = null])
 static object The raiseWarning (string $code, string $msg, [mixed $info = null])
 static boolean registerErrorLevel (integer $level, string $name, [string $handler = 'ignore'])
 static string renderBacktrace (integer $error)
 static mixed setErrorHandling (integer $level, string $mode, [mixed $options = null])
 static reference throwError (object &$exception)
 static mixed translateErrorLevel (integer $level)
Variables
static array $handlers = array(
E_NOTICE => array('mode' => 'ignore'),E_WARNING=>array('mode'=>'ignore'),E_ERROR=>array('mode'=>'ignore'))
(line 61)

Array of message handlers

  • since: 11.1
  • access: protected
static boolean $legacy = false (line 46)

Legacy error handling marker

  • var: True to enable legacy error handling using JError, false to use exception handling. This flag is present to allow an easy transition into exception handling for code written against the existing JError API in Joomla.
  • since: 11.1
  • access: public
static array $levels = array(E_NOTICE => 'Notice', E_WARNING => 'Warning', E_ERROR => 'Error') (line 54)

Array of message levels

  • since: 11.1
  • access: protected
static array $stack = array() (line 73)

Array containing the error stack

  • since: 11.1
  • access: protected
Methods
static addToStack (line 147)

Method to add non-JError thrown JExceptions to the JError stack for debugging purposes

  • deprecated: 12.1
  • since: 11.1
  • access: public
static void addToStack (JException &$e)
static attachHandler (line 417)

Method that attaches the error handler to JError

static void attachHandler ()
static customErrorHandler (line 829)

Display a message to the user

  • deprecated: 12.1
  • since: 11.1
  • access: public
static void customErrorHandler (integer $level, string $msg)
  • integer $level: The error level - use any of PHP's own error levels for this: E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE.
  • string $msg: Error message, shown to user if need be.
static customErrorPage (line 767)

Display a custom error page and exit gracefully

  • deprecated: 12.1
  • since: 11.1
  • access: public
static void customErrorPage (object &$error)
  • object &$error: Exception object
static detachHandler (line 433)

Method that detaches the error handler from JError

static void detachHandler ()
static getError (line 102)

Method for retrieving the last exception object in the error stack

  • return: Last exception object in the error stack or boolean false if none exist
  • deprecated: 12.1
  • since: 11.1
  • access: public
static mixed getError ([boolean $unset = false])
  • boolean $unset: True to remove the error from the stack.
static getErrorHandling (line 313)

Method to get the current error handler settings for a specified error level.

  • return: All error handling details
  • deprecated: 12.1 Use PHP Exception
  • since: 11.1
  • access: public
static array getErrorHandling (integer $level)
  • integer $level: The error level to retrieve. This can be any of PHP's own error levels, e.g. E_ALL, E_NOTICE...
static getErrors (line 130)

Method for retrieving the exception stack

  • return: Chronological array of errors that have been stored during script execution
  • deprecated: 12.1
  • since: 11.1
  • access: public
static array getErrors ()
static handleCallback (line 750)

Callback error handler

  • Send the error object to a callback method for error handling

  • return: exception object
  • see: JError::raise()
  • deprecated: 12.1
  • since: 11.1
  • access: public
static object The handleCallback (object &$error, array $options)
  • object &$error: Exception object to handle
  • array $options: Handler options
static handleDie (line 648)

Die error handler

  • Echos the error message to output and then dies

  • return: exception object
  • see: JError::raise()
  • deprecated: 12.1
  • since: 11.1
  • access: public
static object The handleDie (object &$error, array $options)
  • object &$error: Exception object to handle
  • array $options: Handler options
static handleEcho (line 529)

Echo error handler

  • Echos the error message to output

  • return: exception object
  • see: JError::raise()
  • deprecated: 12.1
  • since: 11.1
  • access: public
static object The handleEcho (object &$error, array $options)
  • object &$error: Exception object to handle
  • array $options: Handler options
static handleIgnore (line 509)

Ignore error handler

  • Ignores the error

  • return: exception object
  • see: JError::raise()
  • deprecated: 12.1
  • since: 11.1
  • access: public
static object The handleIgnore (object &$error, array $options)
  • object &$error: Exception object to handle
  • array $options: Handler options
static handleLog (line 713)

Log error handler Logs the error message to a system log file

  • return: exception object
  • see: JError::raise()
  • deprecated: 12.1
  • since: 11.1
  • access: public
static object The handleLog (object &$error, array $options)
  • object &$error: Exception object to handle
  • array $options: Handler options
static handleMessage (line 689)

Message error handler Enqueues the error message into the system queue

  • return: exception object
  • see: JError::raise()
  • deprecated: 12.1
  • since: 11.1
  • access: public
static object The handleMessage (object &$error, array $options)
  • object &$error: Exception object to handle
  • array $options: Handler options
static handleVerbose (line 602)

Verbose error handler

  • Echos the error message to output as well as related info

  • return: exception object
  • see: JError::raise()
  • deprecated: 12.1
  • since: 11.1
  • access: public
static object The handleVerbose (object &$error, array $options)
  • object &$error: Exception object to handle
  • array $options: Handler options
static isError (line 85)

Method to determine if a value is an exception object.

  • return: True if argument is an exception, false otherwise.
  • deprecated: 12.1
  • since: 11.1
  • access: public
static boolean isError (mixed $object)
  • mixed $object: Object to check.
static raise (line 173)

Create a new JException object given the passed arguments

  • return: The JException object
  • see: JException
  • deprecated: 12.1 Use PHP Exception
  • since: 11.1
  • access: public
static mixed raise (integer $level, string $code, string $msg, [mixed $info = null], [boolean $backtrace = false])
  • integer $level: The error level - use any of PHP's own error levels for this: E_ERROR, E_WARNING, E_NOTICE, E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE.
  • string $code: The application-internal error code for this error
  • string $msg: The error message, which may also be shown the user if need be.
  • mixed $info: Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
  • boolean $backtrace: Add a stack backtrace to the exception.
static raiseError (line 249)

Wrapper method for the raise() method with predefined error level of E_ERROR and backtrace set to true.

  • return: The configured JError object
  • see: JError::raise()
  • deprecated: 12.1 Use PHP Exception
  • since: 11.1
  • access: public
static object raiseError (string $code, string $msg, [mixed $info = null])
  • string $code: The application-internal error code for this error
  • string $msg: The error message, which may also be shown the user if need be.
  • mixed $info: Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
static raiseNotice (line 295)

Wrapper method for the raise() method with predefined error level of E_NOTICE and backtrace set to false.

  • return: configured JError object
  • see: JError::raise()
  • deprecated: 12.1 Use PHP Exception
  • since: 11.1
  • access: public
static object The raiseNotice (string $code, string $msg, [mixed $info = null])
  • string $code: The application-internal error code for this error
  • string $msg: The error message, which may also be shown the user if need be.
  • mixed $info: Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
static raiseWarning (line 272)

Wrapper method for the raise() method with predefined error level of E_WARNING and backtrace set to false.

  • return: configured JError object
  • see: JError::raise()
  • deprecated: 12.1 Use PHP Exception
  • since: 11.1
  • access: public
static object The raiseWarning (string $code, string $msg, [mixed $info = null])
  • string $code: The application-internal error code for this error
  • string $msg: The error message, which may also be shown the user if need be.
  • mixed $info: Optional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
static registerErrorLevel (line 457)

Method to register a new error level for handling errors

This allows you to add custom error levels to the built-in

  • E_NOTICE
  • E_WARNING
  • E_NOTICE

  • return: True on success; false if the level already has been registered
  • deprecated: 12.1
  • since: 11.1
  • access: public
static boolean registerErrorLevel (integer $level, string $name, [string $handler = 'ignore'])
  • integer $level: Error level to register
  • string $name: Human readable name for the error level
  • string $handler: Error handler to set for the new error level [optional]
static renderBacktrace (line 846)

Render the backtrace

  • return: Contents of the backtrace
  • deprecated: 12.1
  • since: 11.1
  • access: public
static string renderBacktrace (integer $error)
  • integer $error: The error
static setErrorHandling (line 347)

Method to set the way the JError will handle different error levels. Use this if you want to override the default settings.

Error handling modes:

  • ignore
  • echo
  • verbose
  • die
  • message
  • log
  • callback
You may also set the error handling for several modes at once using PHP's bit operations. Examples:
  • E_ALL = Set the handling for all levels
  • E_ERROR | E_WARNING = Set the handling for errors and warnings
  • E_ALL ^ E_ERROR = Set the handling for all levels except errors

  • return: True on success or a JException object if failed.
  • deprecated: 12.1 Use PHP Exception
  • since: 11.1
  • access: public
static mixed setErrorHandling (integer $level, string $mode, [mixed $options = null])
  • integer $level: The error level for which to set the error handling
  • string $mode: The mode to use for the error handling.
  • mixed $options: Optional: Any options needed for the given mode.
static throwError (line 193)

Throw an error

  • see: JException
  • deprecated: 12.1 Use PHP Exception
  • since: 11.1
  • access: public
static reference throwError (object &$exception)
  • object &$exception: An exception to throw.
static translateErrorLevel (line 484)

Translate an error level integer to a human readable string e.g. E_ERROR will be translated to 'Error'

  • return: Human readable error level name or boolean false if it doesn't exist
  • deprecated: 12.1
  • since: 11.1
  • access: public
static mixed translateErrorLevel (integer $level)
  • integer $level: Error level to translate

Documentation generated on Tue, 19 Nov 2013 15:02:38 +0100 by phpDocumentor 1.4.3