JException/ construct
From Joomla! Documentation
< API16:JExceptionRevision as of 00:05, 13 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)
Revision as of 00:05, 13 May 2013 by JoomlaWikiBot (talk | contribs) (removing red link to edit, no existant pages)
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]
Constructor used to set up the error with all needed error details.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax[edit]
__construct($msg, $code=0, $level=null, $info=null, $backtrace=false)
Parameter Name | Default Value | Description |
---|---|---|
$msg | $msg The error message | |
$code | 0 | $code The error code from the application |
$level | null | $level The error level (use the PHP constants E_ALL, E_NOTICE etc.). |
$info | null | $info Optional: The additional error information. |
$backtrace | false | $backtrace True if backtrace information is to be collected |
Defined in[edit]
libraries/joomla/error/exception.php
Importing[edit]
jimport( 'joomla.error.exception' );
Source Body[edit]
public function __construct($msg, $code = 0, $level = null, $info = null, $backtrace = false)
{
$this->level = $level;
$this->code = $code;
$this->message = $msg;
if ($info != null) {
$this->info = $info;
}
if ($backtrace && function_exists('debug_backtrace'))
{
$this->backtrace = debug_backtrace();
for($i = count($this->backtrace) - 1; $i >= 0; --$i)
{
++$i;
if (isset($this->backtrace[$i]['file'])) {
$this->file = $this->backtrace[$i]['file'];
}
if (isset($this->backtrace[$i]['line'])) {
$this->line = $this->backtrace[$i]['line'];
}
if (isset($this->backtrace[$i]['class'])) {
$this->class = $this->backtrace[$i]['class'];
}
if (isset($this->backtrace[$i]['function'])) {
$this->function = $this->backtrace[$i]['function'];
}
if (isset($this->backtrace[$i]['type'])) {
$this->type = $this->backtrace[$i]['type'];
}
$this->args = false;
if (isset($this->backtrace[$i]['args'])) {
$this->args = $this->backtrace[$i]['args'];
}
break;
}
}
// Store exception for debugging purposes!!!
JError::addToStack($this);
parent::__construct($msg, (int) $code);
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples[edit]
<CodeExamplesForm />