Re: Try{} Catch()
| From: | Martin Alterisio | Date: | Sun, 23 Dec 2007 21:50:48 +0000 |
| Subject: | Re: Try{} Catch() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266241@lists.php.net to get a copy of this message | ||
It's not supposed to be practical, it's just a way to handle errors. You
shouldn't rely on try/catch for algorithm implementation.
You create exceptions for errors and unexpected behavior. Then in some other
part of the system you use try/catch to prevent the code from terminating
abruptly. You catch the exception (you should know which exceptions can be
thrown), and act accordingly. Either closing resources, add a log message
with debug information, and/or sending an error message to the user.
2007/12/23, Al <news@ridersite.org>:
>
> Try() and Catch() seems neat; but, I've not found it to be very practical.
>
> Anyone using it? How?
>
> Al...
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>