Re: When is an Exception not an Exception?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Dec 31, 2008 at 12:41 PM, <ceo@xxxxxxxxx> wrote:

>
> We have code like this:
>
> try
> {
>  $details = $this->__client->getData($email); //Line 274
> }
> catch (SoapFault $sf)
> {
>  //do stuff
> }
> catch (Exception $e)
> {
>  //do more general stuff
> }
>
> SoapFault: No data found in C:\classes\Client.php on line 274
>
> Hello?
>
> What is the point of all this try/catch stuff, eh?
>

you dont have to use it if you dont want, in fact you could strip it out of
that code segment if you wanted to.


> I don't think we've done anything particularly fancy/tricky with the class
> hierarchy.
>

nobody said you did, but that has no bearing on the fact that the Soap
extension throws exceptions.  as i said you dont have to catch them, but the
idea is they provide opportunities for your code to degrade gracefully in
the event of a problem occurring.

-nathan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux