Re: Mail_IMAP 2.0.0 alpha 1
| From: | Klaus Guenther | Date: | Tue, 06 Jul 2004 09:01:03 +0000 |
| Subject: | Re: Mail_IMAP 2.0.0 alpha 1 | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-31623@lists.php.net to get a copy of this message | ||
David Costa wrote:
On Jul 6, 2004, at 10:36 AM, Klaus Guenther wrote:Exceptions are fatal if not caught. Warnings and notices should never be fatal. ErrorStack is about the latter, not the former. If you notice, in the mail I originally replied to, Bertrand mentioned trigger_error along with native exceptions. I think that this is the wrong way to do things. PEAR_Exception should be used instead of simple exceptions. And PEAR_ErrorStack should be used instead of trigger_error(). I did not mean for either to step into the other's territory.David Costa wrote:I disagree. PHP 5 provides a good mechanism to handle the same notices via exceptions and PEAR_Exceptions is simple enough for every PHP 5 developer. I have no problem whatsoever with developers who might prefer to use ErrorStack but I would have a major problem to add yet another mechanism when PHP 5 already provides the right tool to achieve the same result.just jumping into this, I don't think we should force errorStack vs exceptions in PHP 5. Cheers David CostaThis was not my suggestion. For notices/warnings, ErrorStack is currently the best solution we have.
Does this throw a notice? or is it an exception? (Note: I've not looked into PEAR_Exception besides the very first rough draft.)For errors/exceptions, we can use PEAR_Exception. I don't see a problem with enforcing the use of the two packages for their respective purposes.well for my PHP 5 package I would use something like: if (!count($this->database)) {throw new PEAR_Exception(self::DB_SQLITE_TOOLS_NAR."$this->database", -1);}
I don't really see why I would need to add something else on the top of the exception. Oh well, since ErrorStack is not PHP 5 ready I shouldn't worry too much about it within my package ;)I still don't think you understand. PEAR_ErrorStack should not wrap or replace exceptions. Instead, it is there for warnings and notices that should not be fatal if not caught. That's it's purpose, and yes, PEAR_ErrorStack is the best we have _for that purpose_. Same with PEAR_Exception being the best solution for handling exceptions within PEAR. If your package does not need notices or warnings, you of course don't need to use ErrorStack ;-) And anyway, notice my request to Greg to port ErrorStack because of this particular need. Klaus