Custom Exception Types - MACROMEDIA COLDFUSION 5-DEVELOPING Develop Manual

Table of Contents

Advertisement

210
<!--- Use cfcatch with TYPE="Any" --->
<!--- to find unexpected exceptions. --->
<cfcatch type="Any">
</cftry>
To test the code:
1
2
3
4

Custom Exception Types

The
which can be caught by a
A
cfthrow
</cfcatch>
<cfoutput>
<h1>Other Error: #cfcatch.Type#</h1>
<ul>
<li><b>Message:</b> #cfcatch.message#
<li><b>Detail:</b> #cfcatch.Detail#
</ul>
</cfoutput>
</cfcatch>
</body>
</html>
Make sure there is no includeme.cfm file and display the page. The
type="MissingInclude"
Create a non-empty includeme.cfm file and display the page. If your database is
configured properly you should see an employee entry and not get any error.
In the
tag change the line:
cfquery
FROM Employee
to:
FROM Employer
Display the page. This time the
error message
.
Correct Employer back to Employee. Change the
<p>Department: #Dept_ID#<br>
to:
<p>Department: #DepartmentID#<br>
Display the page. This time the
message indicating an expression error.
attribute allows a
type
tag without a
Chapter 11 Preventing and Handling Errors
block displays the error.
cfcatch type="Database"
cfcatch type="Any"
tag to throw an exception of a specific type,
cfthrow
tag that has a matching
cfcatch
attribute will throw a
type
cfcatch
block displays an
line:
cfoutput
block displays an error
attribute.
type
="Application" exception.
type

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 5-DEVELOPING and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 5

Table of Contents