API15:JError/setErrorHandling
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Method to set the way the JError will handle different error levels. Use this if you want to override the default settings.
Description:JError/setErrorHandling
Syntax
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
mixed True on success, or a object if failed.
Defined in
libraries/joomla/error/error.php
Importing
jimport( 'joomla.error.error' );
Source Body
function setErrorHandling($level, $mode, $options = null) { $levels = $GLOBALS['_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 $GLOBALS['_JERROR_HANDLERS'][$eLevel] = array ('mode' => $mode); if ($options != null) { $GLOBALS['_JERROR_HANDLERS'][$eLevel]['options'] = $options; } } return true; }
[Edit See Also] SeeAlso:JError/setErrorHandling
Examples
<CodeExamplesForm />
