Barney, Interestingly, as I noted in my previous email, TRY's and Catchs under script operate differently. So this is also a problem. For example, cut and past the following and run:
<cftry> <cfset test()> <cfcatch type="any"> <cfoutput>CFCatch Exists - #IsDefined("cfcatch")#</cfoutput> </cfcatch> </cftry> <cfscript> try { test(); } catch(Any excpt) { writeoutput("<br>CFCatch Exists - #IsDefined("cfcatch")#"); } </cfscript> <cffunction name="Test"> <cfthrow message="This is a throw error"> </cffunction> Andy -----Original Message----- From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 8:49 PM To: CF-Talk Subject: RE: Can I Throw within <cfscript>??? You can't. You have to define a throw() function elsewhere that wraps the CFTHROW tag, and include the definition before it's used. But before you go down this road too far, I would be quite surprised if the next version of CF doesn't have a 'throw' keyword in CFSCRIPT. I was utterly shocked when they added try {} catch () {} without it. If 'Test' will always be inside a CFC, then you can add a throw() method to /WEB-INF/cftags/component.cfc so that all your CFCs would inherit the method. However, that would preclude you from distributing any application that uses it. barneyb > -----Original Message----- > From: Andy Ousterhout [mailto:[EMAIL PROTECTED] > Sent: Tuesday, September 16, 2003 6:34 PM > To: CF-Talk > Subject: RE: Can I Throw within <cfscript>??? > > > Bryan, > > Here is sample code. First, observe that the two catch blocks behave > differently. Second, can you replace the throw in Test with a script > statement without changing the other code? > > <cftry> > <cfset test()> > <cfcatch type="any"> > <cfoutput>CFCatch Exists - #IsDefined("cfcatch")#</cfoutput> > </cfcatch> > </cftry> > > <cfscript> > try { > test(); > } > catch(Any excpt) { > writeoutput("<br>CFCatch Exists - #IsDefined("cfcatch")#"); > } > </cfscript> > > <cffunction name="Test"> > <cfthrow message="This is a throw error"> > </cffunction> > > Andy ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm