Re: Constructors and Exceptions

From: Date: Thu, 01 Jul 2004 05:13:23 +0000
Subject: Re: Constructors and Exceptions
References: 1 2  Groups: php.pecl.dev 
Request: Send a blank email to pecl-dev+get-921@lists.php.net to get a copy of this message
Throwing an exception is the only sane way to handle errors that prevent object construction. If you're excepto-phobic (a new phrase I just invented), then you should have no code in your ctor and instead have some kind of start() or init() method. This is, of course, just a waste of cpu--why call two functions when you can call one? --Wez. On Thu, 1 Jul 2004 04:06:28 +0000, Curt Zirzow <pecl-dev@zirzow.dyndns.org> wrote: > There was a large discussion on the behaviour of exception handling > a few months back on internals. iirc, the decision was to not throw > excepctions in construtors.

« previous php.pecl.dev (#921) next »