You _have_ to use cfthrow within test to throw within test. -----Original Message----- From: Andy Ousterhout [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 10:03 PM To: CF-Talk Subject: RE: Can I Throw within <cfscript>???
Bryan, This is not the same code. All you are doing is returning from a function call. You are NOT throwing an exception within test. Andy -----Original Message----- From: Bryan F. Hogan [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 9:03 PM To: CF-Talk Subject: RE: Can I Throw within <cfscript>??? Here is the answer <cftry> <!--- This line throws error ---> <cfset test1()> <cfcatch type="any"> <cfoutput>#test(message="CFCatch Exists - #IsDefined("cfcatch")#")#</cfoutput> </cfcatch> </cftry> <br> <cfscript> try { test1(); } catch(Any excpt) { writeoutput(test(message="CFCatch Exists - #IsDefined("excpt")#")); } </cfscript> <cffunction name="Test"> <cfargument name="message"> <cfset myMessage=Arguments.message> <cfreturn myMessage> </cffunction> -----Original Message----- From: Andy Ousterhout [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 9: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 -----Original Message----- From: Bryan F. Hogan [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 8:18 PM To: CF-Talk Subject: RE: Can I Throw within <cfscript>??? Ok, I need some more information. Please post an example of your cfc and your cfml page -----Original Message----- From: Andy Ousterhout [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 16, 2003 9:00 PM To: CF-Talk Subject: RE: Can I Throw within <cfscript>??? Not what I am looking to do. I wish for the method to stop processing when I throw the exception and for control to return to the Try/Catch blocks. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| 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 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm