note 46416 deleted from language.exceptions by felipe
| From: | felipe@php.net | Date: | Sun, 20 Apr 2008 16:52:20 +0000 |
| Subject: | note 46416 deleted from language.exceptions by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-138581@lists.php.net to get a copy of this message | ||
Note Submitter: gomikochar at yahoo dot com
----
To re-throw an exception, you must specify the name of the variable after throw in the catch block,
i.e.,
<?php
try {
try {
throw new Exception("Unknown error");
}
catch (Exception $ie) { // Inner Catch Block
throw; // this will NOT work; parse error
throw $ie; // this will re-throw the exception to the outer catch block
}
}
catch (Exception $oe) { // Outer Catch Block
echo $oe;
}
?>