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 Use PHP Exception
  • abstract:
  • since: 11.1

Located in /libraries/joomla/error/error.php (line 34)


	
			
Variable Summary
static mixed $handlers
static boolean $legacy
static array $levels
static mixed $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 mixed $handlers = array(
E_NOTICE => array('mode' => 'ignore'),E_WARNING=>array('mode'=>'ignore'),E_ERROR=>array('mode'=>'ignore'))
(line 54)
  • access: protected
static boolean $legacy = false (line 44)

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 52)

Array of message levels

  • since: 11.1
  • access: protected
static mixed $stack = array() (line 60)
  • access: protected
Methods
static method addToStack (line 140)

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 method attachHandler (line 420)

Method that attaches the error handler to JError

static void attachHandler ()
static method customErrorHandler (line 836)

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 method customErrorPage (line 778)

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 method detachHandler (line 437)

Method that detaches the error handler from JError

static void detachHandler ()
static method getError (line 93)

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 method getErrorHandling (line 314)

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 method getErrors (line 122)

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 method handleCallback (line 760)

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 method handleDie (line 658)

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 method handleEcho (line 537)

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 method handleIgnore (line 516)

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 method handleLog (line 725)

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 method handleMessage (line 700)

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 method handleVerbose (line 611)

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 method isError (line 74)

Method to determine if a value is an exception object. This check supports both JException and PHP5 Exception objects

  • 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 method raise (line 167)

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 method raiseError (line 246)

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 method 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 method raiseWarning (line 271)

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

  • return: configured JError object
  • see: JError
  • 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 method registerErrorLevel (line 462)

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 method renderBacktrace (line 854)

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 method setErrorHandling (line 349)

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 method throwError (line 190)

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 method translateErrorLevel (line 490)

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 Mon, 25 Jun 2012 13:54:28 -0500 by phpDocumentor 1.4.4