JError
class JError
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
Properties
static boolean | $legacy | Legacy error handling marker |
Methods
Method to determine if a value is an exception object.
Method for retrieving the last exception object in the error stack
Method for retrieving the exception stack
Method to add non-JError thrown JExceptions to the JError stack for debugging purposes
Create a new JException object given the passed arguments
Wrapper method for the raise() method with predefined error level of E_ERROR and backtrace set to true.
Wrapper method for the {@link raise()} method with predefined error level of E_WARNING and backtrace set to false.
Wrapper method for the {@link raise()} method with predefined error level of E_NOTICE and backtrace set to false.
Method to get the current error handler settings for a specified error level.
Method to set the way the JError will handle different error levels. Use this if you want to override the default settings.
Method that attaches the error handler to JError
Method that detaches the error handler from JError
Method to register a new error level for handling errors
Translate an error level integer to a human readable string e.g. E_ERROR will be translated to 'Error'
Echo error handler - Echos the error message to output
Verbose error handler - Echos the error message to output as well as related info
Die error handler - Echos the error message to output and then dies
Message error handler Enqueues the error message into the system queue
Log error handler Logs the error message to a system log file
Callback error handler - Send the error object to a callback method for error handling
Display a message to the user
Details
static
JException|boolean
getError(
boolean $unset = false)
Method for retrieving the last exception object in the error stack
static
void
addToStack(
JException $e)
Method to add non-JError thrown JExceptions to the JError stack for debugging purposes
static
JException
raise(
integer $level,
string $code,
string $msg,
mixed $info = null,
boolean $backtrace = false)
Create a new JException object given the passed arguments
static
JException
raiseError(
string $code,
string $msg,
mixed $info = null)
Wrapper method for the raise() method with predefined error level of E_ERROR and backtrace set to true.
static
JException
raiseWarning(
string $code,
string $msg,
mixed $info = null)
Wrapper method for the {@link raise()} method with predefined error level of E_WARNING and backtrace set to false.
static
JException
raiseNotice(
string $code,
string $msg,
mixed $info = null)
Wrapper method for the {@link raise()} method with predefined error level of E_NOTICE and backtrace set to false.
static
array
getErrorHandling(
integer $level)
Method to get the current error handler settings for a specified error level.
static
boolean|JException
setErrorHandling(
integer $level,
string $mode,
mixed $options = null)
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: - EALL = Set the handling for all levels - EERROR | EWARNING = Set the handling for errors and warnings - EALL ^ E_ERROR = Set the handling for all levels except errors
static
boolean
registerErrorLevel(
integer $level,
string $name,
string $handler = 'ignore')
Method to register a new error level for handling errors
This allows you to add custom error levels to the built-in - ENOTICE - EWARNING - E_NOTICE
static
string|boolean
translateErrorLevel(
integer $level)
Translate an error level integer to a human readable string e.g. E_ERROR will be translated to 'Error'
static
JException
handleIgnore(
JException $error,
array $options)
Ignore error handler - Ignores the error
static
JException
handleEcho(
JException $error,
array $options)
Echo error handler - Echos the error message to output
static
JException
handleVerbose(
JException $error,
array $options)
Verbose error handler - Echos the error message to output as well as related info
static
void
handleDie(
JException $error,
array $options)
Die error handler - Echos the error message to output and then dies
static
JException
handleMessage(
JException $error,
array $options)
Message error handler Enqueues the error message into the system queue
static
JException
handleLog(
JException $error,
array $options)
Log error handler Logs the error message to a system log file
static
JException
handleCallback(
JException $error,
array $options)
Callback error handler - Send the error object to a callback method for error handling