CFERROR ColdFusion Error Template Will Not Catch Its Own Errors
Posted June 28, 2006 at 5:03 PM by Ben Nadel
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.
- Wanted: Full-Time ColdFusion Developer at Intoria Internet Architects
- Cold Fusion Senior Developer at Edge Information Management
- Back-End Web Developer-Information Technologist at Michigan State University
- ColdFusion Developer at Nonfat Media
- Mid-to-Senior Level Web Application Developer at SiteVision, Inc.
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?
There probably is something wrong in the error handler. Try cfdumping out CFERROR in the beginning and aborting.
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.