Re: Simple error handling/catching/avoidance

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

 



It's the reason why I can't stand exceptions in PHP, we talked about this a bunch at our meeting on Wednesday.

You still have to suppress the error through one of several methods (using @ or custom error handler that does not display it) 

AND then you have to throw an exception manually. 

I fact, I don't even know how you would write one for that type of error. Live to hear some more input. 


Sent from my iPhone 4s

On Jun 8, 2012, at 6:30 AM, "Jacob Kruger" <jacob@xxxxxxxxxxxxx> wrote:

> Just wondering why the following code actually renders an error message instead of just then invoking the catch clause:
> 
> //start code
> $iVar1 = 0;
> $iVar2 = 10;
> try {
> echo $iVar2 / $iVar1;
> } catch (Exception $e) {
> echo "No division by zero allowed";
> }
> //end of code
> 
> Stay well
> 
> Jacob Kruger
> Blind Biker
> Skype: BlindZA
> '...fate had broken his body, but not his spirit...'


This message (including any attachments) may contain confidential or otherwise privileged information and is intended only for the individual(s) to which it is addressed. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secured or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message or that arise as a result of e-mail transmission. If verification is required please request a hard-copy version from the sender.

www.pridedallas.com


-- 
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [PHP Users]     [PHP Database Programming]     [PHP Install]     [Kernel Newbies]     [Yosemite Forum]     [PHP Books]

  Powered by Linux