Re: [PEPr] Comment on Web Services::Services_Memotoo
| From: | Thomas Pequet | Date: | Thu, 24 Apr 2008 17:10:35 +0000 |
| Subject: | Re: [PEPr] Comment on Web Services::Services_Memotoo | ||
| References: | 1 2 3 4 5 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-49876@lists.php.net to get a copy of this message | ||
Ok Philippe and Till I have added this syntax in my code:
catch (SoapFault $e) {
throw new Services_Memotoo_Exception($e->faultstring, (int)$e->faultcode);} and change the return value. Till, I don't know why you don't see the packages.xml file in the tgz file because I use "pear package" to create it and normally if you follow this link you can see the packages.xml file: -> http://www.memotoo.com/softs/?dossier=PEAR_Services_Memotoo&action=afficherfic&fic=Services_Memotoo-lasted.tgz ("lasted" is correct ? normally if my english is good, "lasted" is "the last version" ) I don't know how to set constant error in my Exception class ? Can you give an example ??? Thank ! Thomas till a écrit :
On Wed, Apr 23, 2008 at 8:24 PM, Thomas Pequet <webmaster@memotoo.com> wrote:Ok I have understood now ;-) If I have add a class "Services_Memotoo_Exception" extends PEAR_Exception, delete all info "_lastError" and log error file in my class Services_Memotoo. Also I have updated the examples files.Sorry to bug, but .... catch (SoapFault $e) {throw new Services_Memotoo_Exception($e->faultcode." :: ". $e->faultstring); return false; }... should look like: catch (SoapFault $e) {throw new Services_Memotoo_Exception($e->faultstring, $e->faultcode); }If you do this, I can catch outside the class with... try { ... } catch (Services_Memotoo_Exception $e) { if ($e->getCode() == 1234) { } elseif ($e->getCode() == 56789) { // fault code is 56789 } else { // rethrow throw $e; } } Know what I mean? Ideally, you would define your error constants in your class, document them and add them to the exception thrown so people match your error constants instead of SOAP's (less documentation to read, and I bet a general "ERR_SOAP" works in most cases ;-)). By the way, your Services_Memotoo-lastest.tgz (latest?) also doesn't contain a package.xml. If you run "pear package" inside the directory with all your files, it should create a correct package accordingly. :-) Till