xref: /web-php/manual/en/class.exception.php (revision 50202bbf)
1<?php
2include_once __DIR__ . '/../../include/shared-manual.inc';
3$TOC = array();
4$PARENTS = array();
5include_once __DIR__ ."/toc/reserved.exceptions.inc";
6$setup = array (
7  'home' =>
8  array (
9    0 => 'index.php',
10    1 => 'PHP Manual',
11  ),
12  'head' =>
13  array (
14    0 => 'UTF-8',
15    1 => 'en',
16  ),
17  'this' =>
18  array (
19    0 => 'class.exception.php',
20    1 => 'Exception',
21  ),
22  'up' =>
23  array (
24    0 => 'reserved.exceptions.php',
25    1 => 'Predefined Exceptions',
26  ),
27  'prev' =>
28  array (
29    0 => 'reserved.exceptions.php',
30    1 => 'Predefined Exceptions',
31  ),
32  'next' =>
33  array (
34    0 => 'exception.construct.php',
35    1 => 'Exception::__construct',
36  ),
37  'alternatives' =>
38  array (
39  ),
40  'extra_header_links' =>
41  array (
42    'rel' => 'alternate',
43    'href' => '/manual/en/feeds/class.exception.atom',
44    'type' => 'application/atom+xml',
45  ),
46);
47$setup["toc"] = $TOC;
48$setup["parents"] = $PARENTS;
49manual_setup($setup);
50
51?>
52<div id="class.exception" class="reference">
53 <h1 class="title">Exception</h1>
54
55
56 <div class="partintro"><p class="verinfo">(PHP 5 &gt;= 5.1.0)</p>
57
58
59  <div class="section" id="exception.intro">
60   <h2 class="title">Introduction</h2>
61   <p class="para">
62    <span class="ooclass"><strong class="classname">Exception</strong></span> is the base class for
63    all Exceptions.
64   </p>
65  </div>
66
67
68  <div class="section" id="exception.synopsis">
69   <h2 class="title">Class synopsis</h2>
70
71
72   <div class="classsynopsis">
73    <div class="ooclass"></div>
74
75
76    <div class="classsynopsisinfo">
77     <span class="ooclass">
78      <strong class="classname">Exception</strong>
79     </span>
80     {</div>
81
82
83    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Properties */</div>
84    <div class="fieldsynopsis">
85     <span class="modifier">protected</span>
86     <span class="type">string</span>
87      <var class="varname"><a href="class.exception.php#exception.props.message">$<var class="varname">message</var></a></var>
88    ;</div>
89
90    <div class="fieldsynopsis">
91     <span class="modifier">protected</span>
92     <span class="type">int</span>
93      <var class="varname"><a href="class.exception.php#exception.props.code">$<var class="varname">code</var></a></var>
94    ;</div>
95
96    <div class="fieldsynopsis">
97     <span class="modifier">protected</span>
98     <span class="type">string</span>
99      <var class="varname"><a href="class.exception.php#exception.props.file">$<var class="varname">file</var></a></var>
100    ;</div>
101
102    <div class="fieldsynopsis">
103     <span class="modifier">protected</span>
104     <span class="type">int</span>
105      <var class="varname"><a href="class.exception.php#exception.props.line">$<var class="varname">line</var></a></var>
106    ;</div>
107
108
109    <div class="classsynopsisinfo classsynopsisinfo_comment">/* Methods */</div>
110    <div class="constructorsynopsis dc-description">
111   <span class="modifier">public</span>  <span class="methodname"><a href="exception.construct.php" class="methodname">__construct</a></span>
112    ([ <span class="methodparam"><span class="type">string</span> <code class="parameter">$message</code><span class="initializer"> = &quot;&quot;</span></span>
113   [, <span class="methodparam"><span class="type">int</span> <code class="parameter">$code</code><span class="initializer"> = 0</span></span>
114   [, <span class="methodparam"><span class="type"><a href="class.exception.php" class="type Exception">Exception</a></span> <code class="parameter">$previous</code><span class="initializer"> = <strong><code>NULL</code></strong></span></span>
115  ]]] )</div>
116
117    <div class="methodsynopsis dc-description">
118   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="exception.getmessage.php" class="methodname">getMessage</a></span>
119    ( <span class="methodparam">void</span>
120   )</div>
121<div class="methodsynopsis dc-description">
122   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">Exception</span> <span class="methodname"><a href="exception.getprevious.php" class="methodname">getPrevious</a></span>
123    ( <span class="methodparam">void</span>
124   )</div>
125<div class="methodsynopsis dc-description">
126   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">mixed</span> <span class="methodname"><a href="exception.getcode.php" class="methodname">getCode</a></span>
127    ( <span class="methodparam">void</span>
128   )</div>
129<div class="methodsynopsis dc-description">
130   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="exception.getfile.php" class="methodname">getFile</a></span>
131    ( <span class="methodparam">void</span>
132   )</div>
133<div class="methodsynopsis dc-description">
134   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><a href="exception.getline.php" class="methodname">getLine</a></span>
135    ( <span class="methodparam">void</span>
136   )</div>
137<div class="methodsynopsis dc-description">
138   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">array</span> <span class="methodname"><a href="exception.gettrace.php" class="methodname">getTrace</a></span>
139    ( <span class="methodparam">void</span>
140   )</div>
141<div class="methodsynopsis dc-description">
142   <span class="modifier">final</span> <span class="modifier">public</span> <span class="type">string</span> <span class="methodname"><a href="exception.gettraceasstring.php" class="methodname">getTraceAsString</a></span>
143    ( <span class="methodparam">void</span>
144   )</div>
145<div class="methodsynopsis dc-description">
146   <span class="modifier">public</span> <span class="type">string</span>  <span class="methodname"><a href="exception.tostring.php" class="methodname">__toString</a></span>
147    ( <span class="methodparam">void</span>
148   )</div>
149<div class="methodsynopsis dc-description">
150   <span class="modifier">final</span> <span class="modifier">private</span> <span class="type">void</span> <span class="methodname"><a href="exception.clone.php" class="methodname">__clone</a></span>
151    ( <span class="methodparam">void</span>
152   )</div>
153
154   }</div>
155
156
157
158  </div>
159
160
161  <div class="section" id="exception.props">
162   <h2 class="title">Properties</h2>
163   <dl>
164
165    <dt id="exception.props.message">
166     <span class="term"><var class="varname"><var class="varname">message</var></var></span>
167     <dd>
168
169      <p class="para">The exception message</p>
170     </dd>
171
172    </dt>
173
174    <dt id="exception.props.code">
175     <span class="term"><var class="varname"><var class="varname">code</var></var></span>
176     <dd>
177
178      <p class="para">The exception code</p>
179     </dd>
180
181    </dt>
182
183    <dt id="exception.props.file">
184     <span class="term"><var class="varname"><var class="varname">file</var></var></span>
185     <dd>
186
187      <p class="para">The filename where the exception was created</p>
188     </dd>
189
190    </dt>
191
192    <dt id="exception.props.line">
193     <span class="term"><var class="varname"><var class="varname">line</var></var></span>
194     <dd>
195
196      <p class="para">The line where the exception was created</p>
197     </dd>
198
199    </dt>
200
201   </dl>
202
203  </div>
204
205
206 </div>
207
208<h2>Table of Contents</h2>
209    <ul class="chunklist chunklist_reference">
210        <li><a href="exception.construct.php">Exception::__construct</a> — Construct the exception</li>
211        <li><a href="exception.getmessage.php">Exception::getMessage</a> — Gets the Exception message</li>
212        <li><a href="exception.getprevious.php">Exception::getPrevious</a> — Returns previous Exception</li>
213        <li><a href="exception.getcode.php">Exception::getCode</a> — Gets the Exception code</li>
214        <li><a href="exception.getfile.php">Exception::getFile</a> — Gets the file in which the exception occurred</li>
215        <li><a href="exception.getline.php">Exception::getLine</a> — Gets the line in which the exception occurred</li>
216        <li><a href="exception.gettrace.php">Exception::getTrace</a> — Gets the stack trace</li>
217        <li><a href="exception.gettraceasstring.php">Exception::getTraceAsString</a> — Gets the stack trace as a string</li>
218        <li><a href="exception.tostring.php">Exception::__toString</a> — String representation of the exception</li>
219        <li><a href="exception.clone.php">Exception::__clone</a> — Clone the exception</li>
220    </ul>
221</div>
222<?php manual_footer([]); ?>
223