JError/setErrorHandling
From Joomla! Documentation
< API16:JError
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Method to set the way the JError will handle different error levels. Use this if you want to override the default settings.
<! removed transcluded page call, red link never existed >
Syntax[edit]
static setErrorHandling($level, $mode, $options=null)
Parameter Name | Default Value | Description |
---|---|---|
$level | $level The error level for which to set the error handling | |
$mode | $mode The mode to use for the error handling. | |
$options | null | $options Optional: Any options needed for the given mode. |
Returns[edit]
mixed True on success, or a object if failed.
Defined in[edit]
libraries/joomla/error/error.php
Importing[edit]
jimport( 'joomla.error.error' );
Source Body[edit]
public static function setErrorHandling($level, $mode, $options = null)
{
$levels = JError::$levels;
$function = 'handle'.ucfirst($mode);
if (!is_callable(array ('JError',$function))) {
return JError::raiseError(E_ERROR, 'JError:'.JERROR_ILLEGAL_MODE, 'Error Handling mode is not known', 'Mode: '.$mode.' is not implemented.');
}
foreach ($levels as $eLevel => $eTitle)
{
if (($level & $eLevel) != $eLevel) {
continue;
}
// set callback options
if ($mode == 'callback')
{
if (!is_array($options)) {
return JError::raiseError(E_ERROR, 'JError:'.JERROR_ILLEGAL_OPTIONS, 'Options for callback not valid');
}
if (!is_callable($options))
{
$tmp = array ('GLOBAL');
if (is_array($options)) {
$tmp[0] = $options[0];
$tmp[1] = $options[1];
}
else {
$tmp[1] = $options;
}
return JError::raiseError(E_ERROR, 'JError:'.JERROR_CALLBACK_NOT_CALLABLE, 'Function is not callable', 'Function:'.$tmp[1].' scope '.$tmp[0].'.');
}
}
// save settings
JError::$handlers[$eLevel] = array ('mode' => $mode);
if ($options != null) {
JError::$handlers[$eLevel]['options'] = $options;
}
}
return true;
}
<! removed transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]