Method to add non-JError thrown JExceptions to the JError stack for debugging purposes
Method that attaches the error handler to JError
static void
attachHandler
()
Display a message to the user
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.
Display a custom error page and exit gracefully
static void
customErrorPage
(object &$error)
-
object
&$error: Exception object
Method that detaches the error handler from JError
static void
detachHandler
()
Method for retrieving the last exception object in the error stack
static mixed
getError
([boolean $unset = false])
-
boolean
$unset: True to remove the error from the stack.
Method to get the current error handler settings for a specified error level.
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...
Method for retrieving the exception stack
static array
getErrors
()
Callback error handler
- Send the error object to a callback method for error handling
static object The
handleCallback
(object &$error, array $options)
-
object
&$error: Exception object to handle
-
array
$options: Handler options
Die error handler
- Echos the error message to output and then dies
static object The
handleDie
(object &$error, array $options)
-
object
&$error: Exception object to handle
-
array
$options: Handler options
Echo error handler
- Echos the error message to output
static object The
handleEcho
(object &$error, array $options)
-
object
&$error: Exception object to handle
-
array
$options: Handler options
Ignore error handler
static object The
handleIgnore
(object &$error, array $options)
-
object
&$error: Exception object to handle
-
array
$options: Handler options
Log error handler Logs the error message to a system log file
static object The
handleLog
(object &$error, array $options)
-
object
&$error: Exception object to handle
-
array
$options: Handler options
Message error handler Enqueues the error message into the system queue
static object The
handleMessage
(object &$error, array $options)
-
object
&$error: Exception object to handle
-
array
$options: Handler options
Verbose error handler
- Echos the error message to output as well as related info
static object The
handleVerbose
(object &$error, array $options)
-
object
&$error: Exception object to handle
-
array
$options: Handler options
Method to determine if a value is an exception object.
static boolean
isError
(mixed $object)
-
mixed
$object: Object to check.
Create a new JException object given the passed arguments
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.
Wrapper method for the raise() method with predefined error level of E_ERROR and backtrace set to true.
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).
Wrapper method for the raise() method with predefined error level of E_NOTICE and backtrace set to false.
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).
Wrapper method for the raise() method with predefined error level of E_WARNING and backtrace set to false.
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).
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
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]
Render the backtrace
static string
renderBacktrace
(integer $error)
-
integer
$error: The error
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
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.
Throw an error
static reference
throwError
(object &$exception)
-
object
&$exception: An exception to throw.
Translate an error level integer to a human readable string e.g. E_ERROR will be translated to 'Error'
static mixed
translateErrorLevel
(integer $level)
-
integer
$level: Error level to translate