Difference between revisions of "JError/throwError"
From Joomla! Documentation
< API16:JError
m (removing red link to edit, no existant pages) |
|||
Line 1: | Line 1: | ||
− | |||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Syntax=== | ===Syntax=== | ||
Line 65: | Line 64: | ||
<span class="editsection" style="font-size:76%;"> | <span class="editsection" style="font-size:76%;"> | ||
− | <nowiki>[< | + | <nowiki>[<! removed edit link to red link >]</nowiki> |
</span> | </span> | ||
− | + | <! removed transcluded page call, red link never existed > | |
===Examples=== | ===Examples=== | ||
Line 80: | Line 79: | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API16]] |
Revision as of 00:05, 13 May 2013
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.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
static throwError(&$exception)
Parameter Name | Default Value | Description |
---|---|---|
&$exception |
Defined in[edit]
libraries/joomla/error/error.php
Importing[edit]
jimport( 'joomla.error.error' );
Source Body[edit]
public static function throwError(&$exception)
{
static $thrown = false;
// If thrown is hit again, we've come back to JError in the middle of throwing another JError, so die!
if ($thrown)
{
//echo debug_print_backtrace();
jexit('Infinite loop detected in JError');
}
$thrown = true;
$level = $exception->get('level');
// see what to do with this kind of error
$handler = JError::getErrorHandling($level);
$function = 'handle'.ucfirst($handler['mode']);
if (is_callable(array('JError', $function))) {
$reference = &call_user_func_array(array('JError',$function), array(&$exception, (isset($handler['options'])) ? $handler['options'] : array()));
}
else {
// This is required to prevent a very unhelpful white-screen-of-death
jexit(
'JError::raise -> Static method JError::' . $function . ' does not exist.' .
' Contact a developer to debug' .
'<br /><strong>Error was</strong> ' .
'<br />' . $exception->getMessage()
);
}
//we don't need to store the error, since JException already does that for us!
//remove loop check
$thrown = false;
return $reference;
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />