User Guide

Table Of Contents
Handling runtime exceptions with ColdFusion tags 329
To test the code:
1.
Make sure there is no includeme.cfm file and display the page. The cfcatch
type="MissingInclude"
block displays the error.
2.
Create a nonempty includeme.cfm file and display the page. If your database is configured
properly, you should see an employee entry and not get any error.
3.
In the cfquery tag, change the line:
FROM Employee
to:
FROM Employer
Display the page. This time the cfcatch type="Database" block displays an error message.
4.
Change Employer to Employee.
Change the
cfoutput line:
<p>Department: #Dept_ID#<br>
to:
<p>Department: #DepartmentID#<br>
Display the page. This time the cfcatch type="Any" block displays an error message
indicating an expression error.
5.
Change DepartmentID back to Dept_ID and redisplay the page. The page displays properly.
Open \CFusion\Log\MyAppPage.log in your text editor. You should see a header line, an
initialization line, and four detail lines, similar to the following:
"Severity","ThreadID","Date","Time","Application","Message"
"Information","web-0","11/20/01", "16:27:08",,
"cf_root\runtime\servers\default\logs\ MyAppPage.log initialized"
"Information","web-0","11/20/01","16:27:08",,
"Page: web_root/MYStuff/MyDocs/ cftryexample.cfm Error: MissingInclude"
"Information","web-1","11/20/01","16:27:32",,"
Page: web_root/MYStuff/MyDocs/ cftryexample.cfm Error: "
"Information","web-0","11/20/01","16:27:49",,
"Page: web_root/MYStuff/MyDocs/ cftryexample.cfm Error: Database"
"Information","web-1","11/20/01","16:28:21",,
"Page: web_root/MYStuff/MyDocs/ cftryexample.cfm Error: General Exception"
"Information","web-0","11/20/01","16:28:49",,
"Page: web_root/MYStuff/MyDocs/ cftryexample.cfm Error: "