Re: try..catch
| From: | Zeev Suraski | Date: | Wed, 30 Aug 2000 21:17:44 +0000 |
| Subject: | Re: try..catch | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-31327@lists.php.net to get a copy of this message | ||
You could throw any expression, including an object of whatever class. The only issue is that the catch statement will always be executed. If you want to handle only certain types of value, e.g., only values which are objects of type CapsExceptionClass, it would be your responsibility to check that the thrown expression (if there was one) belongs to that class, and propagate the exception otherwise.
Zeev
At 00:15 31/08/2000, Mathieu Kooiman (ggInternet) wrote:
Well it WOULD be nice if you could throw/catch an user-class.. ofcourse.. but I guess thats pushing my luck :-) Nice feature, can't wait to see it:)) On Thu, 31 Aug 2000, Zeev Suraski wrote: At 00:01 31/08/2000, Mathieu Kooiman (ggInternet) wrote:-- Zeev Suraski <zeev@zend.com> http://www.zend.com/I discussed this with you once on #PHP (I'm CaPS) Uhm.. back then you said you didn't want anything like throw() .. Why did you change your mind on that?What I didn't want is a Java-like, object based catch statement. I don't want the catch statement to catch certain types of objects in the language level, have several catch statements for the same try, etc. Instead, I believe it's much more important to answer the need to cleanly recover from language-level errors on one hand, and give end users the ability to send information to the error recovery code in userland code. This, coupled with the ability to selectively propagate the exception in case your code fails to handle it (using very simple means with virtually no language-level support), gives you all the power you need, without tying the implementation to an object oriented niche, and while keeping it very simple. Zeev -- Zeev Suraski <zeev@zend.com> http://www.zend.com/ -- PHP Development Mailing List <http://www.php.net/> To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net For additional commands, e-mail: php-dev-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net