aztec
asked on
"jumping" within a TRY...EXCEPT
Hi ...
I've got a situation in my app where I need to go *back* to a point in my main code (within the TRY) after the EXCEPT code has executed. To illustrate:
TRY
...
...
...
gohere:
...
...
EXCEPT
...
...
END;
...I've tried using a goto statement ('goto gohere') within the scope of the EXCEPT, and also after the END; but both result in a "[Error] 'GOTO leads into or out of TRY statement".
Is there any way to do this?
Thanks
Shawn
I've got a situation in my app where I need to go *back* to a point in my main code (within the TRY) after the EXCEPT code has executed. To illustrate:
TRY
...
...
...
gohere:
...
...
EXCEPT
...
...
END;
...I've tried using a goto statement ('goto gohere') within the scope of the EXCEPT, and also after the END; but both result in a "[Error] 'GOTO leads into or out of TRY statement".
Is there any way to do this?
Thanks
Shawn
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try
TRY
...
...
...
gohere:
...
...
EXCEPT
...
...
END;
Finally
...//You must to do after except!
end;
Is that all right?
TRY
...
...
...
gohere:
...
...
EXCEPT
...
...
END;
Finally
...//You must to do after except!
end;
Is that all right?
How about a bit of feedback, aztec??
SanDao, I think you missed the point, aztec is trying to call the failed code repeatedly (obviously until the code passes because of changed values).
Stu
SanDao, I think you missed the point, aztec is trying to call the failed code repeatedly (obviously until the code passes because of changed values).
Stu
ASKER
This does the trick - thank you Stuart
Cheers
Shawn
Cheers
Shawn
No problems, Shawn!
Thanks for the grading.
Stu.
Thanks for the grading.
Stu.
Oh,Yeah, I see!
Thank you for your help,Stuart!
Thank you for your help,Stuart!
I agree gotos are a curse.
Or if you do not want to do the whole try block again then simply turn the code segment into a procedure you can call from inside the try block, and then again from inside the exept block.
procedure ProcX;
begin
.
.
.
end;
try
ProcX;
except
.. code to fix the error condition.
ProcX;
end;