Re: try/catch inside a cfscript tag

2007-02-12 Thread Matt Quackenbush
What exactly do you mean by not working?

On 2/12/07, Dave Hatz [EMAIL PROTECTED] wrote:

 I am trying to figure out why my try/catch is not working inside the
 following code example below.  Can someone please clue me in on what I am
 doing wrong here?



~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2  MX7 integration  create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:269592
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: try/catch inside a cfscript tag

2007-02-12 Thread Ben Doom
The first argument to the catch block should be an exception type.  I 
think you meant to use Any there.

--Ben Doom

Dave Hatz wrote:
 I am trying to figure out why my try/catch is not working inside the 
 following code example below.  Can someone please clue me in on what I am 
 doing wrong here?
 
 Thanks,
 Dave Hatz
 
 cffunction name=CheckIt returntype=boolean
 cfscript
   var chars=hello ColdFusion World;
   var j=; 
   try {
 for (i = 1; i lte 8; i=i+1) {
   j = j + ((Mid(chars,i,1)));
 }
 result = true;
   }
   catch (Exception e) {
 result = false;
   }
 /cfscript
 cfreturn result
 /cffunction
 
 

~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2  MX7 integration  create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:269593
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: try/catch inside a cfscript tag

2007-02-12 Thread Peter Boughton
My guess would be its not working because trying to add strings is failing at 
compile time rather than runtime?

Try changing it to j = j  Mid(chars,i,1);



 I am trying to figure out why my try/catch is not working inside the 
 following code example below.  Can someone please clue me in on what I 
 am doing wrong here?
 
 Thanks,
 Dave Hatz
 
 cffunction name=CheckIt returntype=boolean
 cfscript
  
 var chars=hello ColdFusion World;
  
 var j=; 
  
 try {

 for (i = 1; i lte 8; i=i+1) {
  
 j = j + ((Mid(chars,i,1)));

 }

 result = true;
  
 }
  
 catch (Exception e) {

 result = false;
  
 }
 /cfscript
 cfreturn result
/cffunction

~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2  MX7 integration  create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:269594
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


RE: try/catch inside a cfscript tag

2007-02-12 Thread Dave Hatz
Matt,
By not working, I mean the code will throw an error, so I want the Catch
to trigger and return a false value.  This for loop is trivial.  I want to
make sure I have the correct syntax for the try/catch.  

When the function does get an error, the catch is not being picked up and I
can't figure out why not?

Dave 

-Original Message-
From: Matt Quackenbush [mailto:[EMAIL PROTECTED] 
Sent: Monday, February 12, 2007 4:01 PM
To: CF-Talk
Subject: Re: try/catch inside a cfscript tag

What exactly do you mean by not working?

On 2/12/07, Dave Hatz [EMAIL PROTECTED] wrote:

 I am trying to figure out why my try/catch is not working inside the 
 following code example below.  Can someone please clue me in on what I 
 am doing wrong here?





~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2  MX7 integration  create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:269607
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: try/catch inside a cfscript tag

2007-02-12 Thread Matt Quackenbush
Dave,

Thanks for the explanation, but Ben's reply is actually the answer to your
dilemma.  In the catch () block, change 'Exception' to 'Any', and it'll
perform as expected.


Matt


On 2/12/07, Dave Hatz [EMAIL PROTECTED] wrote:

 Matt,
 By not working, I mean the code will throw an error, so I want the Catch
 to trigger and return a false value.  This for loop is trivial.  I want to
 make sure I have the correct syntax for the try/catch.

 When the function does get an error, the catch is not being picked up and
 I
 can't figure out why not?

 Dave



~|
Upgrade to Adobe ColdFusion MX7 
Experience Flex 2  MX7 integration  create powerful cross-platform RIAs 
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:269608
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4