Question
Easy <cftry> question
This should be an easy question.
When writing a <cftry> statement, is it ok to abort within the cfcatch/cftry statement or is that a no no for writing code?
Abort within catch statement:
<cftry>
<cfquery name="">
</cfquery>
<cfcatch type="any">
<cfinclude template="index.cfm">
<cfabort>
</cfcatch>
</cftry>
This is the code I have been using but maybe I don't need to do this:
<cfset foundDatabaseError = "No">
<cftry>
<cfquery name="">
</cfquery>
<cfcatch type="any">
<cfset foundDatabaseError = "Yes">
</cfcatch>
</cftry>
<cfif foundDatabaseError equal "Yes">
<cfinclude template="index.cfm">
<cfabort>
</cfif>
My thought was to close the <cftry> statement before jumping to another page but maybe that is not necessary.
Comments?
When writing a <cftry> statement, is it ok to abort within the cfcatch/cftry statement or is that a no no for writing code?
Abort within catch statement:
<cftry>
<cfquery name="">
</cfquery>
<cfcatch type="any">
<cfinclude template="index.cfm">
<cfabort>
</cfcatch>
</cftry>
This is the code I have been using but maybe I don't need to do this:
<cfset foundDatabaseError = "No">
<cftry>
<cfquery name="">
</cfquery>
<cfcatch type="any">
<cfset foundDatabaseError = "Yes">
</cfcatch>
</cftry>
<cfif foundDatabaseError equal "Yes">
<cfinclude template="index.cfm">
<cfabort>
</cfif>
My thought was to close the <cftry> statement before jumping to another page but maybe that is not necessary.
Comments?
