JError
Error Handling Class
This class is inspired in design and concept by patErrorManager http://www.php-tools.net
patErrorManager contributors include:
- gERD Schaufelberger [email protected]
- Sebastian Mordziol [email protected]
- Stephan Schmidt [email protected]
| package |
Joomla.Platform |
|---|---|
| subpackage |
Error |
| since |
11.1 |
| deprecated |
12.1 Use PHP Exception |
Methods
addToStack
Method to add non-JError thrown JExceptions to the JError stack for debugging purposes
addToStack(\JException &$e) : void
attachHandler
Method that attaches the error handler to JError
attachHandler() : void
| deprecated |
12.1 |
|---|---|
| see | \set_error_handler |
| since |
11.1 |
customErrorHandler
Display a message to the user
customErrorHandler(integer $level, string $msg) : void
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $level
integerThe 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.- $msg
stringError message, shown to user if need be.
customErrorPage
Display a custom error page and exit gracefully
customErrorPage( &$error) : void
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $error
detachHandler
Method that detaches the error handler from JError
detachHandler() : void
| deprecated |
12.1 |
|---|---|
| see | \restore_error_handler |
| since |
11.1 |
getError
Method for retrieving the last exception object in the error stack
getError(boolean $unset = false) : mixed
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $unset
booleanTrue to remove the error from the stack.
Response
mixedLast exception object in the error stack or boolean false if none exist
getErrorHandling
Method to get the current error handler settings for a specified error level.
getErrorHandling(integer $level) : array
| deprecated |
12.1 Use PHP Exception |
|---|---|
| since |
11.1 |
Arguments
- $level
integerThe error level to retrieve. This can be any of PHP's own error levels, e.g. E_ALL, E_NOTICE...
Response
arrayAll error handling details
getErrors
Method for retrieving the exception stack
getErrors() : array
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Response
arrayChronological array of errors that have been stored during script execution
handleCallback
Callback error handler
- Send the error object to a callback method for error handling
handleCallback( &$error, array $options) : object
| deprecated |
12.1 |
|---|---|
| see | \JError::raise() |
| since |
11.1 |
Arguments
- $error
- $options
arrayHandler options
Response
objectThe exception object
handleDie
Die error handler
- Echos the error message to output and then dies
handleDie( &$error, array $options) : object
| deprecated |
12.1 |
|---|---|
| see | \JError::raise() |
| since |
11.1 |
Arguments
- $error
- $options
arrayHandler options
Response
objectThe exception object
handleEcho
Echo error handler
- Echos the error message to output
handleEcho( &$error, array $options) : object
| deprecated |
12.1 |
|---|---|
| see | \JError::raise() |
| since |
11.1 |
Arguments
- $error
- $options
arrayHandler options
Response
objectThe exception object
handleIgnore
Ignore error handler
- Ignores the error
handleIgnore( &$error, array $options) : object
| deprecated |
12.1 |
|---|---|
| see | \JError::raise() |
| since |
11.1 |
Arguments
- $error
- $options
arrayHandler options
Response
objectThe exception object
handleLog
Log error handler Logs the error message to a system log file
handleLog( &$error, array $options) : object
| deprecated |
12.1 |
|---|---|
| see | \JError::raise() |
| since |
11.1 |
Arguments
- $error
- $options
arrayHandler options
Response
objectThe exception object
handleMessage
Message error handler Enqueues the error message into the system queue
handleMessage( &$error, array $options) : object
| deprecated |
12.1 |
|---|---|
| see | \JError::raise() |
| since |
11.1 |
Arguments
- $error
- $options
arrayHandler options
Response
objectThe exception object
handleVerbose
Verbose error handler
- Echos the error message to output as well as related info
handleVerbose( &$error, array $options) : object
| deprecated |
12.1 |
|---|---|
| see | \JError::raise() |
| since |
11.1 |
Arguments
- $error
- $options
arrayHandler options
Response
objectThe exception object
isError
Method to determine if a value is an exception object. This check supports both JException and PHP5 Exception objects
isError( &$object) : boolean
| since |
11.1 |
|---|---|
| deprecated |
12.1 |
Arguments
- $object
Response
booleanTrue if argument is an exception, false otherwise.
raise
Create a new JException object given the passed arguments
raise(integer $level, string $code, string $msg, mixed $info = null, boolean $backtrace = false) : mixed
| since |
11.1 |
|---|---|
| deprecated |
12.1 Use PHP Exception |
| see | \JException |
Arguments
- $level
integerThe 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.- $code
stringThe application-internal error code for this error- $msg
stringThe error message, which may also be shown the user if need be.- $info
mixedOptional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).- $backtrace
booleanAdd a stack backtrace to the exception.
Response
mixedThe JException object
raiseError
Wrapper method for the raise() method with predefined error level of E_ERROR and backtrace set to true.
raiseError(string $code, string $msg, mixed $info = null) : object
| deprecated |
12.1 Use PHP Exception |
|---|---|
| see | \JError::raise() |
| since |
11.1 |
Arguments
- $code
stringThe application-internal error code for this error- $msg
stringThe error message, which may also be shown the user if need be.- $info
mixedOptional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
Response
object$error The configured JError object
raiseNotice
Wrapper method for the {@link raise()} method with predefined error level of E_NOTICE and backtrace set to false.
raiseNotice(string $code, string $msg, mixed $info = null) : object
| deprecated |
12.1 Use PHP Exception |
|---|---|
| see | \JError::raise() |
| since |
11.1 |
Arguments
- $code
stringThe application-internal error code for this error- $msg
stringThe error message, which may also be shown the user if need be.- $info
mixedOptional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
Response
objectThe configured JError object
raiseWarning
Wrapper method for the {@link raise()} method with predefined error level of E_WARNING and backtrace set to false.
raiseWarning(string $code, string $msg, mixed $info = null) : object
| deprecated |
12.1 Use PHP Exception |
|---|---|
| see | \JError \JError::raise() |
| since |
11.1 |
Arguments
- $code
stringThe application-internal error code for this error- $msg
stringThe error message, which may also be shown the user if need be.- $info
mixedOptional: Additional error information (usually only developer-relevant information that the user should never see, like a database DSN).
Response
objectThe configured JError object
registerErrorLevel
Method to register a new error level for handling errors
registerErrorLevel(integer $level, string $name, string $handler = 'ignore') : boolean
This allows you to add custom error levels to the built-in
- E_NOTICE
- E_WARNING
- E_NOTICE
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $level
integerError level to register- $name
stringHuman readable name for the error level- $handler
stringError handler to set for the new error level [optional]
Response
booleanTrue on success; false if the level already has been registered
renderBacktrace
Render the backtrace
renderBacktrace(integer $error) : string
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $error
integerThe error
Response
stringContents of the backtrace
setErrorHandling
Method to set the way the JError will handle different error levels. Use this if you want to override the default settings.
setErrorHandling(integer $level, string $mode, mixed $options = null) : mixed
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
| deprecated |
12.1 Use PHP Exception |
|---|---|
| since |
11.1 |
Arguments
- $level
integerThe error level for which to set the error handling- $mode
stringThe mode to use for the error handling.- $options
mixedOptional: Any options needed for the given mode.
Response
mixedTrue on success or a JException object if failed.
throwError
Throw an error
throwError( &$exception) : \reference
| deprecated |
12.1 Use PHP Exception |
|---|---|
| see | \JException |
| since |
11.1 |
Arguments
- $exception
Response
\reference
translateErrorLevel
Translate an error level integer to a human readable string e.g. E_ERROR will be translated to 'Error'
translateErrorLevel(integer $level) : mixed
| deprecated |
12.1 |
|---|---|
| since |
11.1 |
Arguments
- $level
integerError level to translate
Response
mixedHuman readable error level name or boolean false if it doesn't exist
Properties
legacy
Legacy error handling marker
| since |
11.1 |
|---|
Type(s)
boolean
levels
Array of message levels
| since |
11.1 |
|---|
Type(s)
array
handlers
Type(s)
stack
Type(s)