Re: Exception misinformation

From: Date: Thu, 08 Jul 2004 20:12:10 +0000
Subject: Re: Exception misinformation
References: 1 2 3 4 5 6 7  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-31764@lists.php.net to get a copy of this message
Sergio Carvalho wrote:
I agree that exceptions are sometimes a pain in the arse, because they force explicit handling of all errors. This is somewhat strange on a scripting language, and here's where I think PHP developers have a reason to shun exceptions. However, PEAR is a bunch of libraries. Libraries should be more solid than simple scripts, and exceptions are a must.
Even though, I am not (yet) 100% for error handling through exception only, I do actually like the fact they force you deal with them. I always check everything (maybe to an "insane" level for some) so this is not much a new issue from my point of view. However, that may help actually people to raise their programming skills. Maybe exceptions are the shock therapy for slacker coders... For this to work, simple examples are absolutely essentials to not shy away (new) PEAR users. What troubles me most with exceptions is that my code can jump out of the wagon at anytime... This is also true that most errors are fatal, meaning the script cannot do anything useful after that. That doesn't mean it should die right there, IMHO. I'm not 100% sure, but Java forces you to declare what type of exceptions your package can throw, so it limits that potential risk... Basically what I mean is package developers have to be extra careful to catch all exceptions, and eventually repackage them. -Philippe

« previous php.pear.dev (#31764) next »