Re: Try{} Catch()
| From: | Al | Date: | Sun, 23 Dec 2007 21:58:59 +0000 |
| Subject: | Re: Try{} Catch() | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-266242@lists.php.net to get a copy of this message | ||
I understand it's intended use and how to use it, have just not found a good use for it yet.
Martin Alterisio wrote:
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