Quick question about PEAR_Error

From: Date: Thu, 21 Aug 2003 23:56:58 +0000
Subject: Quick question about PEAR_Error
Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-20349@lists.php.net to get a copy of this message
Hi, I've started the work of developing PEAR_Error_Lite, and PEAR_Error, and came across a curious design problem. The PEAR_ERROR_* constants (PEAR_ERROR_RETURN, PEAR_ERROR_CALLBACK, etc.) are designed so that $mode & PEAR_ERROR_BLAH can be used to allow multiple simultaneous error modes. This is a good choice. However, setErrorHandling() doesn't work in this way, it uses a switch statement, which means if you attempt to do this: PEAR::setErrorHandling(PEAR_ERROR_PRINT & PEAR_ERROR_CALLBACK, array(&$this, 'errorhandle')); it will fail with "invalid error mode." The question I have is which way should I code for? Is it impossible to have both an error callback and an error trigger/error die/error throw, etc.? Or should multiple modes be allowed? Just as an update, I've got a PEAR_Error_Lite file that contains everything needed for advanced error handling that weighs in at 130 lines. It's 100% forwards-compatible with PEAR_Error, and provides all the basic functionality that fast scripts might need to provide, and is compatible with my Error_Handler package :) All I need to finish it is to resolve this bizarre conflict. Thanks, Greg

« previous php.pear.dev (#20349) next »