note 77298 deleted from language.exceptions by bjori
| From: | bjori@php.net | Date: | Fri, 28 Nov 2008 17:29:32 +0000 |
| Subject: | note 77298 deleted from language.exceptions by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-147087@lists.php.net to get a copy of this message | ||
Note Submitter: serenity at exscape dot org
----
WOWA: You certainly do *not* need to throw an exception within the try block, that was just an
example.
The only difference from JavaScript is that you need to add a class to catch (i.e. catch (Exception
$e) instead of catch (e)).
Example:
<?php
try
{
// Code that might fail
}
catch (Exception $e)
{
echo "Caught exception: " . $e->getMessage();
// Or ErrorFunc(...) or whatever you'd like to do
}
?>