How to show ColdFusion robust exceptions manually Print

  • 5

Robust exception messages can be helpful when developing applications because of the detail that Adobe ColdFusion provides. However, for security reasons ColdFusion robust exception messages are typically hidden from view. To enable them you need to first enable debugging in the ColdFusion Administrator, and then you need to make usure IIS errors are set to "detailed".

If you do not have access, you can display effective error messages using the following method as an alternative:

To create your own debugging information page you should use the CFERROR tag in your application. We have included an example below, but there is more to this tag than this. Check your ColdFusion documentation. We would also suggest that you use CFTRY, CFCATCH and CFTHROW.

Insert the following two lines at the top of page you want to debug or preferably in your application.cfm page:

<cferror type="exception" template="error.cfm">

<cferror type="request" template="error.cfm">

Create an error.cfm page and FTP it into into the same directory as your application.cfm page:

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<title>ColdFusion Error</title>

</head>

 

<body>

<h2>ColdFusion Error</h2>

<cfoutput>

<ul>

<li><b>Your Location:</b></li>

<p>#error.remoteAddress#</p>

<li><b>Your Browser:</b></li>

<p>#error.browser#</p>

<li><b>Date and Time the Error Occurred:</b></li>

<p>#error.dateTime#</p>

<li><b>Referrer:</b></li>

<p>#error.HTTPReferer#</p>

<li><b>Template:</b></li>

<p>#error.template#</p>

<li><b>Message Content:</b>:

<p>#error.diagnostics#</p>

<li><b>Query String:</b></li>

<p>#error.querystring#</p>

<li><b>Generated Content:</b></li>

<p>#error.generatedcontent#</p>

</ul>

</cfoutput>

</body>

</html>

REF: For more information on the cferror tag, see the Adobe Reference site for cferror

 


Was this answer helpful?

« Back