better flow/grammar

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@203834 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Sean Coates 2005-12-28 19:09:27 +00:00
parent ef84d1bce8
commit 382bf0a5fd

View file

@ -1,21 +1,29 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.1 $ -->
<!-- $Revision: 1.2 $ -->
<chapter id="language.exceptions">
<title>Exceptions</title>
<para>
PHP 5 has an exception model similar to that of other programming languages.
An exception can be thrown, try and caught within PHP. A Try block must
include at least one catch block. Multiple catch blocks can be used to
catch different classtypes; execution will continue after that last catch
block defined in sequence. Exceptions can be thrown within catch blocks.
An exception can be <literal>throw</literal>n, and caught
("<literal>catch</literal>ed") within PHP. Code may be surrounded in a
<literal>try</literal> block, to facilitate the catching of potential
exceptions. Each <literal>try</literal> must have at least one
corresponding <literal>catch</literal> block. Multiple
<literal>catch</literal> blocks can be used to catch different classes of
exeptions. Normal execution (when no exception is thrown within the
<literal>try</literal> block, or when a <literal>catch</literal> matching
the thrown exception's class is not present) will continue after that last catch
block defined in sequence. Exceptions can be <literal>throw</literal>n (or
re-thrown) within a <literal>catch</literal> block.
</para>
<para>
When an exception is thrown, code following the statement will not be
executed and PHP will attempt to find the first matching catch block. If an
exception is not caught a PHP Fatal Error will be issued with an Uncaught
Exception message, unless there has been a handler defined with
<function>set_exception_handler</function>.
executed, and PHP will attempt to find the first matching
<literal>catch</literal> block. If an
exception is not caught, a PHP Fatal Error will be issued with an
"<literal>Uncaught Exception ...</literal>" message, unless a handler has
been defined with <function>set_exception_handler</function>.
</para>
<example>
<title>Throwing an Exception</title>
@ -102,7 +110,7 @@ class MyException extends Exception
parent::__construct($message, $code);
}
// custom string representation of object */
// custom string representation of object
public function __toString() {
return __CLASS__ . ": [{$this->code}]: {$this->message}\n";
}