
277
DEVELOPING
COLDFUSION 9 APPLICATIONS
Developing CFML Applications
Las
t
upda
te
d 8/5/2010
Note:
The onSubmit and onBlur form field validation techniques use JavaScript or Flash validation on the client browser.
About ColdFusion exceptions
Most ColdFusion errors are exceptions. You can categorize ColdFusion exceptions in two ways:
•
When they occur
•
Their type
When exceptions occur
ColdFusion errors can occur at two times, when the CFML is compiled into Java and when the resulting Java executes,
called runtime exceptions.
Compiler exceptions
Compiler exceptions are programming errors that ColdFusion identifies when it compiles CFML into Java. Because
compiler exceptions occur before the ColdFusion page is converted to executable code, you cannot handle them on
the page that causes them. However, other pages can handle these errors. For more information, see “
Handling
compiler exceptions
” on page 282.
Runtime exception
A runtime exception occurs when the compiled ColdFusion Java code runs. It is an event that disrupts the normal flow
of instructions in the application. Exceptions can result from system errors or program logic errors. Runtime
exceptions include:
•
Error responses from external services, such as an ODBC driver or CORBA server
•
CFML errors or the results of
cfthrow
or
cfabort
tags
•
Internal errors in ColdFusion
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 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 “
Validating Data
” on page
743.
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
248.