The following sections describe briefly how ColdFusion handles errors. The rest of this chapter expands on this information.
If a user requests a page that the ColdFusion cannot find, and the Administrator Server Settings Missing Template Handler field specifies a Missing Template Handler page, ColdFusion uses that page to display error information. Otherwise, it displays a standard error message.
When a user enters invalid data in an HTML tag that uses onServer or hidden form field server-side data validation ColdFusion does the following:
onError
event handler method, ColdFusion calls the method.
cferror
that specifies a Validation error handler, ColdFusion displays the specified error page.
For more information on using hidden form field validation, see Validating Data. For more information on Application.cfc, see Designing and Optimizing a ColdFusion Application
If ColdFusion encounters a compiler exception, how it handles the exception depends on whether the error occurs on a requested page or on an included page:
cfinclude
or cfmodule
tag, or on a custom tag page that you access using the cf_ notation, ColdFusion handles it as a runtime exception in the page that accesses the tag. See the Runtime exception errors section, next, for a description of how these errors are handled.
If ColdFusion encounters a runtime exception, it does the action for the first matching condition in the following table:
Condition | Action |
---|---|
The code with the error is inside a |
Executes the code in the If the |
The ColdFusion MX application has an Application.cfc with an |
Executes the code in the |
A |
Uses the error page specified by the |
The Administrator Settings Site-wide Error Handler field specifies an error handler page. |
Uses the custom error page specified by the Administrator setting. |
A |
Uses the error page specified by the |
The default case. |
Uses the standard error message format |
For example, if an exception occurs in CFML code that is not in a cftry
block, and Application.cfc does not have an onError
method, but a cferror
tag specifies a page to handle this error type, ColdFusion uses the specified error page.