API16:JException/ construct
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
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
__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
libraries/joomla/error/exception.php
Importing
jimport( 'joomla.error.exception' );
Source Body
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
<CodeExamplesForm />
