Matt,

Thanks for all that information.  The article has good stuff in it.

My problem is that I have both 2 and 3 implemented.  It seems that 2 never
hits unless I turn off 3.  Is that expected, or is there a way around it?  

Thanks,
Another Matt

-----Original Message-----
From: Matt Robertson
Sent: Wednesday, May 10, 2006 4:23 PM
To: CF-Talk
Subject: Re: Cferror and the site wide handler

Best way to look at error handling:

1. try/catch blocks are for situations where you have an expected potential
error (i.e. a mime type failure on a file upload) and you want to handle
this known likely error in a graceful fashion (i.e. "Hey idiot you cannot
upload an exe file.  Please click here try again.").  You typically surround
portions of code but not entire templates in try/catch blocks, as you need a
try/catch block per template otherwise.

2. The cferror tag, specifically this variant of it:

<cferror type="EXCEPTION" template="/my/error_catcher.cfm">

should be used to house your application-wide error handler, which you
build.  The thing that kicks in to tell you when something has exploded.
This can do nearly the same thing as a site-wide handler, or behave in some
application-specific fashion.  Its all up to you.  I put my cferror
statement in /Application.cfm.

3. The site-wide error handler bats cleanup in case neither of the above are
in place, or they fail for some reason.

I wrote a tutorial on doing a SWEH that is easily adapted to a cferror
handler.  It dumps all data scopes securely to disk, to screen or to email.
The dumps are invaluable in problem diagnosis.  You can write simple code
that dumps error data to screen for a certain range of IPs or logins or
whatever so the same handler works for developers or visitors.

http://mysecretbase.com/Building_A_ColdFusion_Error_Handler.cfm

--
[EMAIL PROTECTED]
Janitor, MSB Web Systems
mysecretbase.com



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:240167
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=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to