Re: Simple error handling/catching/avoidance

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

 



Yup.

That bit of obvious error-generating code was also just an example of something that would definitely generate an error/exception, since current actual issue is that am meant to be using/operating within someone else's sort of containing framework/wrappers, and means can't always be sure what code will work, or generate an error, etc., and just don't want to have to specifically check for all function definitions using function_exists(), etc. etc., but anyway.

Also just that, in most other languages, there is some or other, relatively simple way to handle something like a try - catch exception - and just perform some other action methodology, so was just wondering...?

Stay well

Jacob Kruger
Blind Biker
Skype: BlindZA
'...fate had broken his body, but not his spirit...'

----- Original Message ----- From: "Keith Davis" <keithdavis@xxxxxxxxxxxxxxx>
To: "Jacob Kruger" <jacob@xxxxxxxxxxxxx>
Cc: <php-windows@xxxxxxxxxxxxx>
Sent: Friday, June 08, 2012 3:20 PM
Subject: Re:  Simple error handling/catching/avoidance


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