application.cfm
<!--- Enable site wide error handling. When an error is found, the details
of the error will be sent to error_process.cfm --->
<cferror type="request"
template="error_process.cfm"
mailto="jason@rockenbach.net">
===========================================================
error_process.cfm
<!--- The page template specified in the cferror tag can not contain any cf code.
If there was an error with the code on that page, you would get into and endless loop
of errors --->
<!--- Since we cant use cfmail, we will pass these varibles to another page. The variables will provide us with the details of the error --->
<form name="error_report"
method="post"
action="error.cfm">
<input type="hidden"
name="diagnostics"
value="#error.Diagnostics#">
<input type="hidden"
name="browser"
value="#error.Browser#">
<input type="hidden"
name="remoteaddress"
value="#error.RemoteAddress#">
<input type="hidden"
name="httpreferer"
value="#error.HTTPReferer#">
<input type="hidden"
name="template"
value="#error.Template#">
<input type="hidden"
name="querystring"
value="#error.QueryString#">
</form>
<!--- Javascript to pass variables to next page --->
<script language="JavaScript">
document.error_report.submit();
</script>
===========================================================
error.cfm
<!--- Email Error Message --->
<cfmail from="errors@rockenbach.net"
to="jason@rockenbach.net"
subject="Bug Report">
#form.Diagnostics#
#form.Browser#
#form.RemoteAddress#
#form.HTTPReferer#
#form.Template#
#form.QueryString#
</cfmail>
<html>
<head>
<title>Oops! An error has occurred.</title>
</head>
<body>
<p align="center"><strong>We're Sorry! An error has occurred.</strong><br>
The details of this error have been emailed to the web site administrator.<br>
Please <a href="index.cfm">click here</a> to return to the homepage.</p>
</body>
</html>