Re: [PEPr] Comment on Web Services::Services_Memotoo
| From: | till | Date: | Wed, 23 Apr 2008 19:19:33 +0000 |
| Subject: | Re: [PEPr] Comment on Web Services::Services_Memotoo | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-49865@lists.php.net to get a copy of this message | ||
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