You could also do this.. <cftry> <cfcatch type="database"> Catch database error <cfabort if you need to </cfcatch> <cfcatch type="something else"> <!--- do something else ---> </cfcatch> </cftry>
Regards Andrew Scott Analyst Programmer CMS Transport Systems Level 2/33 Bank Street South Melbourne, Victoria, 3205 Phone: 03 9699 7988 - Fax: 03 9699 7976 Quote: I gather, young man, that you wish to be a Member of Parliament. The first lesson that you must learn is, when I call for statistics about the rate of infant mortality, what I want is proof that fewer babies died when I was Prime Minister than when anyone else was Prime Minister. That is a political statistic. - Sir Winston Leonard Spencer Churchill ---------------------------------------------------------------------------- -------------------------- -----Original Message----- From: Bobby Hartsfield [mailto:[EMAIL PROTECTED] Sent: Wednesday, 19 October 2005 1:36 PM To: CF-Talk Subject: RE: Using try/catch all over the place a good thing? heh Bad Idea(tm) I like that > 1. Your code has errors. There are plenty of cases where you want no indication of an error to be shown to a user (which is exactly what a site wide error handler would indicate), especially when the error involves uploading foreign files to your server or your database choking on the info they tried to pass to it. There are of course better ways to deal with both but they aren't guaranteed to stop any errors from being displayed like an empty cfcatch. > 2. Your user is giving your code input that you didn't anticipate. See above > 3. There is an external problems, like a database being unavailable. I doubt that skipping over an error or two, for whatever reason, would be your biggest problem if there was no database available to your application > 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? As for wrapping cftry/catch around EVERYTHING, I missed that part. I'm not sure how big of a performance hit that would be but it would undoubtedly be one. Not to mention it might tend to make a lazy CF'r out of ya ;) ...:.:.:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com -----Original Message----- From: Justin D. Scott [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 18, 2005 10:51 PM To: CF-Talk Subject: RE: Using try/catch all over the place a good thing? > I'm wrapping some cftry/catchs around my cffiles > and cfquerys. It works pretty sweet if I use > just an empty catch. Hi Will, what is sweet about it, exactly? If your code is generating an error, it means one of several things: -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.344 / Virus Database: 267.12.2/140 - Release Date: 10/18/2005 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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:221444 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

