Patrick McElhaney wrote:

<cfcatch type="Any"><!--- do nothing ---></cfcatch>

Never _ever_ do that!

If you're going to catch an exception, do something with it. Don't
just bury it. I can't tell you how many "that's not possible" moments
I've had while working with legacy code that contains buried
exceptions.

Also, I think a method named "authenticate" should return a boolean.
If you want to get the user's information, I would do that in a
separate method, named something like "retrieveUser." And I would have
that method return an object rather than a query.

HTH,

Patrick


It's late here - so forgive if I miss an obvious reason. I can't really think of reason why you would want to explicitly suppress an error and not do anything about it. I just got Nando's reply and he mentioned the fact that you're returning an empty query anyways.

However, it could become a problem in the future - this is assuming that you're returning an empty query when retrieval doesn't work. The catch type="any" catches any errors that might occur and lets the code continue on your merry way. Hence, it makes it look like the user name and password just doesn't match anything in you ldap server. So, an empty query really either means "no user here by that combo" or "I'm not telling you that I threw an error and pretended like that no user here by that combo". Well, if you are having intermittant problems with your ldap and you don't know it - you could have a hard time figuring out why your login in failing sometimes. I agree with Patrick that - even though you might know exactly what it happening, but others might not (by passing legacy code, new developers, etc). I have a rule when coding - "if you catch something...do something with it". At least log it... It still doesn't sit well with me to return an empty query for that could mean two things (no go or error).

.Peter

--
Peter J. Farrell :: Maestro Publishing

blog    :: http://blog.maestropublishing.com
email   :: [EMAIL PROTECTED]
phone   :: 651-204-0513

"Follow the gourd!  No, Follow the sandal!"
--



----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[email protected]




Reply via email to