Chapter 8: Debugging and Error Handling
</HEAD>
<BODY>
<HR>
<CFINCLUDE TEMPLATE="includeme.cfm">
<CFOUTPUT QUERY="test">
<P>Department: #DepartmentID#
<P>Last Name: #LastName#
<P>First Name: #FirstName#
</CFOUTPUT>
<HR>
<!--- Use CFCATCH to test for missing included files. --->
<!--- Print Message and Detail error messages. --->
<!--- Block executes only if a MissingInclude exception is thrown. --->
4
<CFCATCH TYPE="MissingInclude">
4
</CFCATCH>
<!--- Use CFCATCH to test for database errors.--->
<!--- Print error messages. --->
<!--- Block executes only if a Database exception is thrown. --->
4
<CFCATCH TYPE="Database">
<H1>Database Error</H1>
<CFOUTPUT>
<UL>
<LI><B>Message:</B> #CFCATCH.Message#
<LI><B>Native error code:</B> #CFCATCH.NativeErrorCode#
<LI><B>SQLState:</B> #CFCATCH.SQLState#
<LI><B>Detail:</B> #CFCATCH.Detail#
</UL>
</CFOUTPUT>
4
</CFCATCH>
<!--- Use CFCATCH with TYPE="Any" --->
<!--- to find unexpected exceptions. --->
4
<CFCATCH TYPE="Any">
<H1>Other Error: #CFCATCH.Type#</H1>
<CFOUTPUT>
<TITLE>Test CFTRY/CFCATCH</TITLE>
<H1>Missing Include File</H1>
<CFOUTPUT>
<UL>
<LI><B>Message:</B> #CFCATCH.Message#
<LI><B>Detail:</B> #CFCATCH.Detail#
<LI><B>File name:</B> #CFCATCH.MissingFilename#
</UL>
</CFOUTPUT>
101
Need help?
Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?