CFERROR ColdFusion Error Template Will Not Catch Its Own Errors

Posted June 28, 2006 at 5:03 PM

Tags: ColdFusion

This guy at work could not figure out why some errors in his application were being caught by his error handling template (as defined by the CFError tag) and some were not. The errors being caught were handled nicely. The ones that were seemingly not caught were dumped out on to the page as if no error handler was defined.

This is a common problem that I see with people's error handling template. The problem here is that the CFError template will NOT handle errors that it produces. If this were the case, it could launch into some crazy, infinite loop of error handling. By surrounding the code of the error handling template with CFTry / CFCatch tags, it became immediately apparent that his error handler had a bug in it.

Post Comment  |  Ask Ben  |  Permalink  |  Print Page


You Might Also Be Interested In:




Reader Comments

Jun 3, 2008 at 9:03 AM // reply »
1 Comments

my url is http://localhost/cftest/index.cfm if i made a mistake in index.cfm file, cferror tag does not catch it.
but if i include any other file in index.cfm file and make a mistake in included file , the cferror tag works fine
why is this?


Jun 3, 2008 at 9:18 AM // reply »
6,516 Comments

@Faaiq,

There probably is something wrong in the error handler. Try cfdumping out CFERROR in the beginning and aborting.


Aug 25, 2008 at 1:41 PM // reply »
11 Comments

You may have some type of syntax cvalidation error,
which I am noticing cfError will not handle.

if your error is in an included file, then the include validate fails and it falls under "fail to include x file" and becomes a different type of error.


Post Comment  |  Ask Ben

Recent Blog Comments
Nov 21, 2009 at 6:47 PM
Hal Helms - Real World Object Oriented Development, Sarasota - Day Five
@charlie griefer, Thank you.. ... read »
Nov 21, 2009 at 5:15 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jose Galdamez, Oh heh yeah I didn't paste the whole code. I should have defined the vars -- my bad. It's fixed thou. Thanks. ... read »
Nov 21, 2009 at 4:49 PM
Styling The ColdFusion 8 WriteToBrowser CFImage Output
Great work yet again Ben! Whilst I didn't use this whole code, I copied some of your regex code for a similar problem with the lack of an alt attribute and unescaped ampersands in CFIMAGE for Railo 3 ... read »
Nov 21, 2009 at 1:13 PM
My First ColdFusion Builder Extension - Encrypting And Decrypting CFM / CFC Files
@Ben, Because I am pedantic, I just want to make sure that everyone knows there is absolutely no encryption going on. There is only encoding and obfuscation. The cfencode tool only obfuscates your C ... read »
Nov 21, 2009 at 12:28 PM
Using ColdFusion Structures To Remove Duplicate List Values
@Jody I can't seem to get your code sample to work. If you are still having problems, try this code out and see if it gets you what you wanted. <!--- Comma delimited list with various duplicates ... read »
Nov 21, 2009 at 11:03 AM
Groovy Operator Overloading Does Not Work In The ColdFusion Context
Hi Ben, Thanks for this informative post. Now I am reading ur old posts too ... read »
Nov 21, 2009 at 10:56 AM
HostMySite.com Has The Best ColdFusion Hosting
@Mehul, Yes very nice people, however several downtimes per day which was not acceptable. Hence we had to move out. I am glad you are having good luck with them so far. ... read »