note 115257 added to language.exceptions
| From: | HayleyWatson | Date: | Mon, 23 Jun 2014 06:59:01 +0000 |
| Subject: | note 115257 added to language.exceptions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-199739@lists.php.net to get a copy of this message | ||
Remember that Exceptions are also objects and can be handled as such; they can be constructed in and
returned as values from functions, passed as arguments to other functions, and examined before being
thrown. You don't have to throw it as soon as you have constructed it (the stack trace will of
course reflect the moment the Exception was constructed, not the moment it was thrown).
You might, for example, want to collect additional information to include in YourException but you
don't want to clutter up the YourException class or the code containing the "throw"
statement by collecting the information there. Or you might want to do something (such as logging)
with each Exception that is thrown from a certain region (catch it, pass it to the logging function,
then rethrow it).
----
Server IP: 202.78.240.39
Probable Submitter: 222.155.198.204
----
Manual Page -- http://php.net/manual/en/language.exceptions.php
Edit -- https://master.php.net/note/edit/115257
Del: integrated -- https://master.php.net/note/delete/115257/integrated
Del: useless -- https://master.php.net/note/delete/115257/useless
Del: bad code -- https://master.php.net/note/delete/115257/bad+code
Del: spam -- https://master.php.net/note/delete/115257/spam
Del: non-english -- https://master.php.net/note/delete/115257/non-english
Del: in docs -- https://master.php.net/note/delete/115257/in+docs
Del: other reasons-- https://master.php.net/note/delete/115257
Reject -- https://master.php.net/note/reject/115257
Search -- https://master.php.net/manage/user-notes.php