Re: exceptions
| From: | Klaus Guenther | Date: | Wed, 09 Jun 2004 10:36:30 +0000 |
| Subject: | Re: exceptions | ||
| References: | 1 2 3 4 5 6 7 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30261@lists.php.net to get a copy of this message | ||
Alexey Borzov wrote:
Some obvious things to consider: 1) Most of these "beginners" do have some JavaScript background. And JavaScript obviously has exceptions."some" javascript does not mean that they understand exceptions.
2) I routinely answer questions on pear-general that could've been solved without any posting if the person asking ever bothered to check the return value of the method. If the method in question raised an exception instead of returning a toothless PEAR_Error, he would be *forced* to handle that and I'd have a message less to answer. Seems like a win-win to me.I personally don't like returning a PEAR_Error object. I like it much better the way PEAR_ErrorStack does it, where you have all your problems collected in one place. Quit beating on PEAR_Error. Everyone knows it's got its problems.
In other words: if a person, let's name him Lukas Smith for the sake of example, has idiosyncrasy to exceptions, he may refrain from using them in his packages. But if that person wants to force his idiosyncrasy onto the whole PEAR, he would have to find *extremely* good arguments.I think the main point is that exceptions are only some of the unusual things that might happen. There are lots of others. And with something like PEAR_ErrorStack you can decide what needs to be handled how. Remember, not everything is worth an exception. Klaus