Try/catch code structure

In order for your code to directly handle an exception, the tags in question must appear within a cftry block. It is a good idea to enclose an entire application page in a cftry block. You then follow the cftry block with cfcatch blocks, which respond to potential errors. When an exception occurs within the cftry block, processing is thrown to the cfcatch block for that type of exception.

Here is an outline for using cftry and cfcatch to handle errors:

<cftry> 
    Put your application code here ... 
    <cfcatch type="exception type1"> 
        Add exception processing code here ... 
    </cfcatch> 
    <cfcatch type="exception type2"> 
        Add exception processing code here ... 
    </cfcatch> 
    ... 
    <cfcatch type="Any"> 
        Add exception processing code appropriate for all other exceptions here ... 
    </cfcatch> 
</cftry>