Ben Nadel
On User Experience (UX) Design, JavaScript, ColdFusion, Node.js, Life, and Love.
I am the chief technical officer at InVision App, Inc - a prototyping and collaboration platform for designers, built by designers. I also rock out in JavaScript and ColdFusion 24x7.
Meanwhile on Twitter
Loading latest tweet...
Ben Nadel at BFusion / BFLEX 2010 (Bloomington, Indiana) with: John Farrar

CFERROR ColdFusion Error Template Will Not Catch Its Own Errors

By Ben Nadel on
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.




Reader 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?

Reply to this Comment

@Faaiq,

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

Reply to this Comment

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.

Reply to this Comment

Post A Comment

You — Get Out Of My Dreams, Get Into My Comments
Live in the Now
Oops!
Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.