error handling and conditional inclusion of PEAR.php

From: Date: Sun, 30 May 2004 10:51:47 +0000
Subject: error handling and conditional inclusion of PEAR.php
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12801@lists.php.net to get a copy of this message
Hi all according to a recent post in Harry F's blog that picked up a few interesting comments [1], many developers using PEAR libs are not extending from the base PEAR class and only including it 'on demand' once errors are thrown. I can see how that would work in a situation where PEAR::raiseError() is wrapped, which is quite typical, but how about PEAR::isError() ? Eg, in simple Config code, PEAR.php would need to be loaded to handle potential errors:
    $c = new Config();
    //  read configuration data and get reference to root
    $root = & $c->parseConfig($conf, 'phparray');
    //  write configuration to file
    $result = $c->writeConfig('...', 'inifile');
    if (!PEAR::isError($result)) {
// ...
    }
feedback appreciated :-) cheers Demian [1] http://www.sitepoint.com/blog-post-view.php?id=172065

« previous php.pear.general (#12801) next »