Ask a Jedi: Why isn't my cferror working?

Steve asks:

Huge problem I have: custom Error Handling in CF 8 doesn't work whatever I do. I use a simple Application.cfm:

<cferror type="exception" template="ErrorException.cfm" mailto="">

ErrorException.cfm exists and is NOT empty

The template generating the error is index.cfm:

Is there any other setting I have to enable/disable in CF Admin for this to work? I still get the default CF error message, nothing custom.

What you have is a compiler error, or a syntax error. Consider the normal CF execution process. You request index.cfm. CF takes your ColdFusion and compiles it into Java. In your case, you have a syntax error. CF can't run your code at all - therefore - error handling can't handle it at all. The only fix for your template is to remove the syntax error. If you then ran your file and "i" was never defined, you would correctly see your error template run.

If I may be so bold (yes, I'll do), you should check out my guide on error handling:

The Complete Guide to Adding Error Handling to Your ColdFusion Application. It's guaranteed to be more exciting than filing taxes!

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate. He focuses on JavaScript, serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA