NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP 5 Throwing Exceptions in Constructors

Matthew Terenzio matt at jobsforge.com
Wed Feb 9 22:30:26 EST 2005


On Feb 9, 2005, at 10:00 PM, Matthew Terenzio wrote:

>
> On Feb 9, 2005, at 5:39 PM, Adam Maccabee Trachtenberg wrote:
>
>> If you're concerned a non-essential portion can fail, you can either:
>>
>> a) Don't throw an exception in that instance, return the object, and
>> provide developers with a way to check status.
>>
>> b) Don't place that functionality in the constructor, and provide a
>> method to update the object with the additional data.
>>
>> -adam
>
> Is it possible to gain some insulation in certain cases by using a 
> specific exception subclass object type?

To clarify what I mean, I'm wondering if Hans can't add an additional 
catch like Example 20-3->example 1 below
and somehow only abort the instantiation if a critical exception is 
thrown

http://us3.php.net/manual/en/language.exceptions.php


>
> _______________________________________________
> New York PHP Talk
> Supporting AMP Technology (Apache/MySQL/PHP)
> http://lists.nyphp.org/mailman/listinfo/talk
> http://www.nyphp.org




More information about the talk mailing list