It counts on what's going on. For work, they have their own error handler which I hate (CFLOCATIONS should be used sparingly and never for errors). Lotauctions is mostly the same. On HoF, when a variable has a value other than expected, I change the value based on the section. For example, entering an invalid forumid in the mailing lists section throws you to the mailing list main page. Entering a valid forumid and an invalid threadid throws you to the threads list for that forum. In almost all cases, I set up a default action to take rather than an error message. On the other hand, I see your point and if/when I write any code that has to throw an error I'll keep your technique in mind. I've always tried to be specific about possible errors and the response to them rather than using any sort of general catch. Just my style.
> Ok, so let's ignore how I write a throw() method and just focus on > exceptions in general. Considering the business rule of: > > Argument X must be numeric and greater than 0. > > You can't use <cfargument> alone to validate this. To me, it makes > sense to use cfthrow when the number is < 0. How would you handle it > though? > > -r > > On Fri, 3 Dec 2004 13:05:26 -0500, Michael Dinowitz > <[EMAIL PROTECTED]> wrote: > > Right, and I don't throw events. > > In your example, I'd expect the cfargument tag to handle the error passed and if > > it doesn't, then a CFIF to handle if its LTE 0. I can see where your take would > > make sense but it's not something I've done in the past nor needed to do. I'll > > keep it in mind though in case something does come up. > > Still worth a small techniques article or blog post. > > > > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:5:138712 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/5 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:5 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.5 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54
