Help me understand this.  It is my understanding that cf handles catching
errors in a heiarchial manner, like in java or c++, where catching
type="database|missingInclude|expression" will be caught before type="any"
or any sitewide error handler.  

So this is my problem, I have two nested try/catch blocks, one around the
include of a db template in the initial processing page catching type="any"
error, and one inside of the included page catching type="database" errors.
It seems to work as it's supposed to, well sort of... When the db statement
fails, the nested catch statement does catch the error, sets the variables
and calls the custom tag to log the error, BUT IT DOES NOT ABORT???  CF
continues to process coming out of the template and then being caught by the
top level catch type"any" statement and then finally aborting.  But my
problem is trying to understand why it cf didn't abort in the nested catch
statement?

Am I missing something?

Robert Hinojosa
[EMAIL PROTECTED]
972.243.4343 x7446



CODE:

TEMPLATE 1;
The initial processing template contains this code.

   <cftry>
      <cfinclude template="queries/sql_enterprise_insert.cfm">
          
      <cfcatch type="Any">

        <!--- line that gets executed --->
         <cfabort showerror="Application
error<br>#cfcatch.message#<br>#cfcatch.detail#">
      </cfcatch>
   </cftry> 



TEMPLATE 2;
The included template contains this code.
....

<cftry>

   <cftransaction>
   <cfquery datasource="#request.DSN#" name="qEnterpriseInsert">
        ....INSERT STATEMENT.....
   </cfquery>
   </cftransaction>

   <cfcatch type="Database">
      <cfset message = "Attempting to insert Enterprise row.">
      <cfset catch   = "#cfcatch.message#<br>#cfcatch.detail#">
      <cfset show    = "There was a problem with this database transaction.
Please try again.">
      <cfmodule   Template="/ct/logError.cfm" 
                Key="DATABASE"
                Message="#message#" 
                Catch="#catch#">
        
      <!--- LINE IN QUESTION!!!  WHY WONT THIS EXECUTE???? --->
      <cfabort showerror="#show#<br>#catch#">
   </cfcatch>
</cftry> 




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to