Adobe COLDFUSION 9 Manual page 287

Developing applications
Hide thumbs Also See for COLDFUSION 9:
Table of Contents

Advertisement

DEVELOPING COLDFUSION 9 APPLICATIONS
Developing CFML Applications
Handling form field validation errors
When you use server-side form field validation, the default validation error message describes the error cause plainly
and clearly. However, to give the error message a custom look or provide additional information such as service
contact phone numbers and addresses, use the
initialization code. Or, specify your own validation on the Application.cfm page. An example of such a page is
provided at Example of a validation error page section. You can also place form field validation error handling code in
the Application.cfc
onError
Handling compiler exceptions
You cannot handle compiler exceptions directly on the page where they occur, because the exception is caught before
ColdFusion starts running the page code. Fix all compiler exceptions as part of the development process. Use the
reported error message and the code debugging techniques discussed in
Applications" on page 378 to identify and correct the cause of the error.
Compiler exceptions that occur on pages you access by using the
runtime errors by surrounding the
accessed page gets caught as a runtime error on the base page. However, avoid this "solution" to the problem, as the
correct method for handling compiler errors is to remove them before you deploy the application.
Handling runtime exceptions
You have many choices for handling exceptions, and the exact path you take depends on your application and its
needs. The following table provides a guide to selecting an appropriate technique:
Technique
Use
cftry
Place
those exceptions in a context-specific manner; for example, if you want to display an error message that is specific
to that code.
Use
cftry
out, or access an alternate resource. You can also use the
exception does not harm your application; for example, if a missing resource is not required.
For more information, see
Application.cfc onError
Implement the
method
that are generated by multiple code sections in the application. For more information on error handling using
Application.cfc, see
tag with the
cferror
method.
or
cfinclude
cfmodule
cftry
blocks around specific code sections where exceptions can be expected and you want to handle
blocks where you can recover from an exception. For example, you can retry an operation that times
"Handling runtime exceptions with ColdFusion
onError
method in your Application.cfc to consistently handle application-specific exceptions
"Handling errors in
Application.cfc" on page 247.
Last updated 8/5/2010
attribute in the Application.cfc
Validation
"Debugging and Troubleshooting
or
cfinclude
cfmessagebox
tag in a
block. The compiler exception on the
cftry
tag to continue processing where a specific
cftry
tags" on page 287.
282
tags can be handled as

Advertisement

Table of Contents
loading

Table of Contents