Need an example of how to use "try" and "catch"

Michael Doub mikedoub at gmail.com
Thu Mar 22 13:33:07 EDT 2012


Does anyone have any guidelines as to when you should use the try and catch structure?   I don't really know when or when not to use it.

-= Mike



On Mar 22, 2012, at 1:21 PM, Jim Hurley wrote:

> Thanks Peter.
> 
> The problem now is what do these bloody error numbers translate into.
> Is the a list somewhere?
> 
> When I try:
> 
> on mouseUP
>   try
>  put the cantdelete of me into temp 
> catch tErr
> --- if tErr is ??????
> end try
> end mouseUP
> 
> I get an error of 348,0,0
> 
> Jim
> 
> 
> 
> 
>> Peter Brigham wrote: 
>> 
>> The syntax for the try construction is
>> 
>> try
>>   <command here>
>> catch tError
>>   <other commands here>
>> end try
>> 
>> and the error number is put into the variable tError. So the <other commands> could be, eg,
>> 
>>   if tError = 314 then
>>      answer "range error in loading array"
>>   else if ...
>>      etc.
>>   end if
>> 
>> -- Peter
>> 
>> Peter M. Brigham
>> 
>> pmbrig at gmail.com
>> http://home.comcast.net/~pmbrig
>> 
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list