Resume Next?

Alex Tweedly alex at tweedly.net
Fri Mar 4 10:37:51 EST 2005


N wrote:

>Okay this is a really strange question.  I have several statements all of which could possibly "throw" a 'RR' exception.  However, I would like to evaluate the error and if it was "expected" continue processing at the next statement.  This would be simular to the On Error Resume Next and On Error Resume is Visual Basic 6.x.  I am fully aware of try catch construct I just do not wish to wrap a try catch block around every individual method invovation.
>
>
>Example expected behavior:
>
>function doIt aParameter
>
>  try
>    something a, b, c
>  catch e
>    if e Is not "123" then throw e
>  end try
>
> try
>    something2 a, b, c
>  catch e
>    if e Is not "1234" then throw e
>  end try
>
>end function 
>
>Prefered Behavior:
>
>function doIt a
>  
>
>  try
>    something 1, 2 ,3 , 4
>    something1 a, b,c 
>  catch e
>    if e is not "123" and e is not "1234" then throw e
>    resume next
>  end try
> 
>End function 
>  
>
It ain't pretty, but how about   (typed, not tested)

function doIt  a, b, c
  local tNext
  put 1 into tNext
  repeat forever
     try
      switch tNext
       case 1
          add 1 to tNext
          something1  a, b, c
      case 2
          add 1 to tNext
          something2  a, b, c
      case 3 
          add 1 to tNext
          something3  a, b, c
       default
          exit repeat
    end switch
    catch e
       if e  is not "123" and e is not "1234" then exit repeat
   end try
 end repeat


-- 
Alex Tweedly       http://www.tweedly.net



-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.6.0 - Release Date: 02/03/2005



More information about the Use-livecode mailing list