Simple Coldfusion Error Catching

This should work on CF7: It’s quite generic, but essential. With the example below, add these two functions to your application.cfc and create a template to use for when the error is thrown. This example sends you an email with a dump of all the necessary vars used to troubleshoot.

You could of course use CFFILE to write a line to an html file instead of mailing. Also, dependent on your hosting, some shared hosts may restrict the dumpling of cgi vars ( you’ll get a error instead).

Add this to your application.cfc


Error occurred: #Now()#

Now create your Error Handling page: (I’ve used /extensions/error/ as the folder, but there’s no limit to where you can place it.


An unexpected error has occured.


p>The error has been logged and will be dealt with as soon as possible.

If this problem persists, please Contact Us.

Now test by going to a URL such as
P.s you may want to add url.error as a cfparam.