RE: Simple error handling/catching/avoidance

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

 



I'm confused. 

Can't you just use method_exists(array("Security", "
getUserDepartment"))?

If that throws an error because of class, then just suppress it (@).

Keith Davis (214) 906-5183


-----Original Message-----
From: Jacob Kruger [mailto:jacob@xxxxxxxxxxxxx] 
Sent: Friday, June 08, 2012 9:24 AM
To: php-windows@xxxxxxxxxxxxx
Cc: php-windows@xxxxxxxxxxxxx
Subject: Re:  Simple error handling/catching/avoidance

Ok, and, along the lines of this, I also get the following
error/exception when I try to determine if a function is defined using
function_exists():
Fatal error: Undefined class constant 'getUserDepartment' in
/var/www/business/products/attendance.php on line 52

The other difference there is that to call the getUserDepartment()
function, I need to refer to it via another parent/wrapper object:
Security::getUserDepartment()

And, this, again means that I can't really, at runtime, determine if can
call that function, or not.

Stay well

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

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


> 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


-- 
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