BackUp LevelNext

Exception-Handling Strategies

Developers can use CFTRY with CFCATCH to handle exceptions based on their point of origin within an application page, or based on diagnostic information.

Handling exceptions based on point of origin

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.

Handling exceptions based on diagnostic information

Use CFCATCH with the attribute TYPE="exception type" to catch specific types of exceptions. A CFCATCH handler can further analyze the exception's diagnostic information, and re-throw the exception if the exceptional condition requires further handling.


BackUp LevelNext

allaire

AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.