Missinginclude Exceptions; Exception Handling Strategies; Exception Handling Example - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

100

MissingInclude exceptions

For exceptions related to missing files, where the type of exception is MissingInclude,
the following variable is available:
Property variable
CFCATCH.MISSINGFILENAME

Exception handling strategies

Use CFTRY with CFCATCH to handle exceptions based on their point of origin within
an application page, or based on diagnostic information.
Use the CFTRY tag with one or more CFCATCH blocks to define a ColdFusion block for
exception handling. When an application page raises an error condition, the
ColdFusion server checks the stack of currently active blocks for a corresponding
CFCATCH handler. At extremes, an exception-prone tag might be enclosed in a
specialized combination of CFTRY and CFCATCH to immediately isolate the tag's
exceptions, or to use CFTRY with CFCATCH TYPE="Any" at a main processing level to
gracefully terminate a subsystem's processing in case of an unexpected error.

Exception handling example

The following example shows CFTRY and CFCATCH, using a sample data source called
company and a sample included file,
If an exception occurs during the CFQUERY statement's execution, the application
page flow switches to the CFCATCH TYPE="Database" exception handler. It then
resumes with the next statement after the CFTRY block, once the CFCATCH
TYPE="Database" handler completes.
Similarly, the CFCATCH TYPE="MissingInclude" block handles exceptions raised by
the CFINCLUDE tag. Any unknown, but possibly recoverable, exceptions are handled
by the CFCATCH TYPE="Any" block.
<!--- Wrap code you want to check in a CFTRY block --->
4
<CFTRY>
<CFQUERY NAME="test" DATASOURCE="company">
</CFQUERY>
<HTML>
<HEAD>
SELECT DepartmentID, FirstName, LastName
FROM employees
WHERE employeeID=#EmpID#
Developing Web Applications with ColdFusion
Description
The name of the file missing in an exception of
type MissingInclude.
.
includeme.cfm

Advertisement

Table of Contents
loading
Need help?

Need help?

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

This manual is also suitable for:

Coldfusion 4.5

Table of Contents