Re: Exceptions: How much is too much.
| From: | Paul Scott | Date: | Fri, 05 Jan 2007 05:52:23 +0000 |
| Subject: | Re: Exceptions: How much is too much. | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246574@lists.php.net to get a copy of this message | ||
On Fri, 2007-01-05 at 00:44 -0500, Craige Leeder wrote:
> The question is: How much is too much. Should I use Exceptions to
> handle all of my error reporting/triggering? How about catching them?
> I mean, if I'm using Exceptions for all of my error handling, I could
> easily end up wrapping my entire script in a try block(or at least
> having almost all my end-code within a number of them).
Not sure if I am doing it correctly either, but, what I do is use
try/catch blocks to instantiate all of the objects that I need and then
let the script take over. I also use exceptions to handle SQL errors in
my db abstraction object(s). That way, only real messes are caught and
the script then displays a graceful exit page to the user instead of
screen vomit that may scare them off.
--Paul