User Guide

Table Of Contents
Understanding errors 309
Error causes fall in the broad categories listed in the following table:
Although these categories do not map completely to the way ColdFusion categorizes errors they
provide a useful way of thinking about errors and can help you in preventing and handling errors
in your code.
ColdFusion error types
Before you can effectively manage ColdFusion errors, you must understand how ColdFusion
classifies and handles them. ColdFusion categorizes errors as detailed in the following table:
Note: The onSubmit and onBlur form field validation techniques use JavaScript or Macromedia
Flash validation on the client browser; this chapter does not discuss client-side validation errors.
Most ColdFusion errors are exceptions. The following sections describe them in detail.
Category Description
Program errors Can be in the code syntax or the program logic. The ColdFusion compiler
identifies and reports program syntax errors when it compiles CFML into Java
classes. Errors in your application logic are harder to locate. For information on
debugging tools and techniques, see Chapter 18, “Debugging and
Troubleshooting Applications,” on page 423.
Unlike ColdFusion syntax errors, SQL syntax errors are only caught at runtime.
Data errors Are typically user data input errors. You use validation techniques to identify
errors in user input data and enable the user to correct the errors.
System errors Can come from a variety of causes, including database system problems, time-
outs due to excessive demands on your server, out-of-memory errors in the
system, file errors, and disk errors.
Type Description
Exception An error that prevents normal processing from continuing. All ColdFusion
exceptions are, at their root, Java exceptions.
Missing template An HTTP request for a ColdFusion page that cannot be found. Generated if a
browser requests a ColdFusion page that does not exist.
Missing template errors are different from missing include exceptions, which
result from
cfinclude tags or custom tag calls that cannot find their targets.
Form field data
validation
Server-side form field validation errors are a special kind of ColdFusion MX
exception. You specify server-side form validation by using
cfform attributes or
hidden HTML form fields. All other types of server-side validation, such as the
cfparam tag generate runtime exceptions. For more information on validating
form fields see Chapter 28, “Validating Data,” on page 659.
ColdFusion includes a built-in error page for server-side form field validation
errors, and the
cferror tag includes a type attribute that lets you handle these
errors in a custom error page, but if you use
onError processing in
Application.cfc, or try/catch error handling, the error appears as an Application
exception. For more information on handling Form field validation in
Application.cfc see “Handling server-side validation errors in the onError
method” on page 290.