You can have errors dumped to the screen in dev, and quietly handled in 
production, if you keep the try/catch.

You probably understood what I was saying earlier, but just in case, I'll 
reiterate my point.  If you call some sort of error handling function inside 
the cfcatch blocks, you can do whatever you want in that function.  For 
example, you can:

- Have errors in production emailed to you, but not errors in dev.
- Have errors dumped to the screen when it's your IP, but emailed to you when 
it's someone else's.
- Write errors to an HTML file that you can read even if you don't have access 
to the filesystem or ColdFusion logs.
- Handle different types of errors differently, so that some types of errors 
can be logged, others passed back to the screen, etc.
- Rethrow errors for some people/environments, and not for others.

All of this can be done by adding one line to each cfcatch block.  There are 
security implications to some of the suggestions above, so be careful where you 
log & email your errors if they contain potentially sensitive information.

- Andrew.

On 2010-07-13, at 14:31, Shannon Rhodes wrote:

> 
> Thanks all, great suggestions.  I especially like the find/replace option, 
> since I don't have access to the administrator and log files here.
> 
> Andrew, this is a dev site that I fully expect to error dozens of times, my 
> main task being clean-up.  It costs time and aggravation when these errors 
> are handled so I have to detect the issue as a logical error rather than as a 
> hard error.  This is a new site based on an old site where about half the 
> object references are now directed to a new schema, resulting in database 
> errors.  So yes, this is an example of a situation where hard errors to the 
> screen are more efficient than gracefully degrading errors and having them 
> quietly sent to admin.
> 
> I heartily endorse proper use of try/catch in production environments, but 
> dev is a different beast.
> 
>> Is there any global way to turn off try/catch handling?  I believe 
>> I've heard of this for VB but I don't think I've come across it for CF.
>> 
>> 
>> My issue is that I'm creating a new version of a site based on an 
>> existing codebase, and I have to update the schema references and some 
>> other cleanup.  It's a lot easier to fix a hard error than to 
>> notice/track down logical errors (i.e. did the item I just saved not 
>> show up because it wasn't saved or because the query to display is 
>> wrong).
>> 
>> It's clunky to go around commenting out try/catch blocks. 
> 
> 
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335304
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm

Reply via email to