Joomla! 1.5 API

Packages

Package: Joomla-Framework

License

Content on this site is copyright © 2005 - 2011 Open Source Matters Inc and can be used in accordance with the Joomla! Electronic Documentation License. Some parts of this website may be subject to other licenses.

 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>

  • since: 1.5

Located in /joomla/error/error.php (line 63)

Class JError   (Subpackage Error)
Method Summary
Static method static void customErrorPage ( &$error, object $error)
Static method static mixed &getError ([ $unset = false])
Static method static array getErrorHandling (int $level)
Static method static array &getErrors ()
Static method static object The &handleCallback ( &$error, array $options, object $error)
Static method static object The &handleDie ( &$error, array $options, object $error)
Static method static object The &handleEcho ( &$error, array $options, object $error)
Static method static object The &handleIgnore ( &$error, array $options, object $error)
Static method static object The &handleLog ( &$error, array $options, object $error)
Static method static object The &handleMessage ( &$error, array $options, object $error)
Static method static object The &handleVerbose ( &$error, array $options, object $error)
Static method static boolean isError (mixed &$object)
Static method static mixed &raise (int $level, string $code, string $msg, [mixed $info = null], [ $backtrace = false])
Static method static object &raiseError (string $code, string $msg, [mixed $info = null])
Static method static object &raiseNotice (string $code, string $msg, [mixed $info = null])
Static method static object &raiseWarning (string $code, string $msg, [mixed $info = null])
Static method static boolean registerErrorLevel (int $level, string $name, [string $handler = 'ignore'])
Static method static mixed setErrorHandling (int $level, string $mode, [mixed $options = null])
Static method static mixed translateErrorLevel (int $level)
Method void attachHandler ()
Method void customErrorHandler ( $level,  $msg)
Method void detachHandler ()
Methods
attachHandler (line 294)

Method that attaches the error handler to JError

void attachHandler ()
customErrorHandler (line 580)
void customErrorHandler ( $level,  $msg)
  • $level
  • $msg
customErrorPage (line 542)

Display a custom error page and exit gracefully

  • since: 1.5
void customErrorPage ( &$error, object $error)
  • object $error: Exception object
  • &$error
detachHandler (line 305)

Method that dettaches the error handler from JError

void detachHandler ()
getError (line 91)

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
  • since: 1.5
  • access: public
mixed &getError ([ $unset = false])
  • $unset
getErrorHandling (line 215)

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

  • return: All error handling details
  • since: 1.5
array getErrorHandling (int $level)
  • int $level: The error level to retrieve. This can be any of PHP's own error levels, e.g. E_ALL, E_NOTICE...
getErrors (line 113)

Method for retrieving the exception stack

  • return: Chronological array of errors that have been stored during script execution
  • since: 1.5
  • access: public
array &getErrors ()
handleCallback (line 528)

Callback error handler

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

object The &handleCallback ( &$error, array $options, object $error)
  • object $error: Exception object to handle
  • array $options: Handler options
  • &$error
handleDie (line 446)

Die error handler

  • Echos the error message to output and then dies

object The &handleDie ( &$error, array $options, object $error)
  • object $error: Exception object to handle
  • array $options: Handler options
  • &$error
handleEcho (line 381)

Echo error handler

  • Echos the error message to output

object The &handleEcho ( &$error, array $options, object $error)
  • object $error: Exception object to handle
  • array $options: Handler options
  • &$error
handleIgnore (line 364)

Ignore error handler

  • Ignores the error

object The &handleIgnore ( &$error, array $options, object $error)
  • object $error: Exception object to handle
  • array $options: Handler options
  • &$error
handleLog (line 496)

Log error handler

  • Logs the error message to a system log file

object The &handleLog ( &$error, array $options, object $error)
  • object $error: Exception object to handle
  • array $options: Handler options
  • &$error
handleMessage (line 476)

Message error handler

  • Enqueues the error message into the system queue

object The &handleMessage ( &$error, array $options, object $error)
  • object $error: Exception object to handle
  • array $options: Handler options
  • &$error
handleVerbose (line 411)

Verbose error handler

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

object The &handleVerbose ( &$error, array $options, object $error)
  • object $error: Exception object to handle
  • array $options: Handler options
  • &$error
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.
  • since: 1.5
  • access: public
boolean isError (mixed &$object)
  • mixed &$object: Object to check
raise (line 131)

Create a new JException object given the passed arguments

  • return: The JException object
  • see: JException
  • since: 1.5
mixed &raise (int $level, string $code, string $msg, [mixed $info = null], [ $backtrace = false])
  • int $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).
  • $backtrace
raiseError (line 169)

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

  • return: The configured JError object
  • since: 1.5
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).
raiseNotice (line 201)

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

  • return: The configured JError object
  • since: 1.5
object &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).
raiseWarning (line 185)

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

  • return: The configured JError object
  • since: 1.5
object &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).
registerErrorLevel (line 325)

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
  • since: 1.5
boolean registerErrorLevel (int $level, string $name, [string $handler = 'ignore'])
  • int $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]
setErrorHandling (line 245)

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.
  • since: 1.5
mixed setErrorHandling (int $level, string $mode, [mixed $options = null])
  • int $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.
translateErrorLevel (line 344)

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
  • since: 1.5
mixed translateErrorLevel (int $level)
  • int $level: Error level to translate
Support Joomla!