Re: [PEPr] Changes in proposal for Configuration::Config_Lite
| From: | Brett Bieber | Date: | Fri, 24 Sep 2010 13:28:00 +0000 |
| Subject: | Re: [PEPr] Changes in proposal for Configuration::Config_Lite | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-53833@lists.php.net to get a copy of this message | ||
On Fri, Sep 24, 2010 at 7:02 AM, till <till@php.net> wrote:
>> Should we better throw an Exception that inherits PEAR_Exception?
>
> Last time this came up, someone said it's fine to use Exception or
> SPL's exceptions.
>
The procedure is to extend the base Exception or an appropriate SPL
Exception, and implement a base/marker exception interface for your
package.
<?php
interface Config_Lite_Exception {}
class Config_Lite_BadFunctionCallException extends
BadFunctionCallException implements Config_Lite_Exception {}
try {
throw new Config_Lite_BadFunctionCallException;
} catch (Config_Lite_Exception $e) {
echo 'Config lite threw an exception';
}
--
Brett Bieber