I missed commenting on the EVERYTHING since I thought he was looking for a
solution to this...

> I can see a problem though where the cffile might 
> work, then the query fails but you don't know it


> you probably want to let the user know about it 
Usually, yes, but again, there are plenty of occassions where you do not
want to do that or do not want to interrupt the remaining experience because
of a trivial error.

As for the planets being aligned... I usually just tell them they have to
hold their mouth right when surfing  lol

..:.:.:.:.:.:.:.:.:.:.:.:.:.:.
Bobby Hartsfield
http://acoderslife.com



-----Original Message-----
From: Justin D. Scott [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, October 19, 2005 8:01 AM
To: CF-Talk
Subject: RE: Using try/catch all over the place a good thing?

> > There are cases where a try/catch block is
> > warranted, so long as it's used properly
> 
> What is the proper use and does it exclude catching
> errors that might be thrown by a cffile or cfquery?

A proper use would be what you described, where you have a file coming in to
be imported and there may be errors when trying to parse it, or an
unexpected result from a web service call, or any number of other places
like this.  Whether you use a site-wide error template or catch the error,
you probably want to let the user know about it (either there's a problem
with the site, a problem with their input, or the planets aren't aligned, or
whatever).  As for CFFILE and CFQUERY, sure, you can catch individual errors
if you like, but I wouldn't bother unless you plan on doing something
specific with them.

Now if you have an instance where the only thing you're using a database for
is pulling banner ads, and the DB isn't available, that would be a case
where you could catch the error, ignore it, and safely move on.  Just make
sure you have some checks in your banner display code for the existence of
your variables and such before trying to display it.  No sense in stopping
the visitor from viewing the site just because your ads are unavailable for
whatever reason.

> As for wrapping cftry/catch around EVERYTHING, I missed
> that part.

That was what started the thread, or at least that's the impression I got
from the original poster; that he wanted to wrap everything in one big
try/catch block.


-Justin Scott




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:221466
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to