FB Needs an ElseIf action, so I don’t have to nest IFs inside of Else actions. Unless there is a better way?
And with Try, what’s with the Finally block?
What’s the difference between this:
Try
-Step1
Catch
-Log Error
Finally
-Step2
End
…And this:
Try
-Step1
Catch
-Log Error
End
Step2
I wish there were another action, maybe called AndTry that would work only if the previous Try didn’t Catch.
So instead of this mess:
Try
-Step1
-Try
–Step2
–Try
—Step3
–Catch
—Log Error3
–End
-Catch
–Log Error2
-End
Catch
-Log Error1
End
…you could do this:
Try
-Step1
Catch
-Log Error1
AndTry
-Step2
Catch
-Log Error2
AndTry
-Step3
Catch
-Log Error3
End
…which just seems easier to read.
The “finally” block is mostly useful without the catch block:
try
do some stuff that might fail
finally
do cleanup, which will get called no matter what
endtry
is very different to:
do some stuff that might fail
do cleanup, which won’t get called if there’s an exception.
In the example you give, the ‘finally’ block will be called even if the ‘try’ block runs an 'Exit action list" action. Not sure about the semantics if an exception is raised - I suspect the two forms have the same behaviour.
Steve
Hi Mike
I agree, an ElseIf action would be useful, I’ll see what we can do. Most probably it would just become an option on the existing If then action.
As for try finally, it works like this :
Try
some stuff that might raise an exception
Catch
handle the exception otherwise do nothing
Finally
run whether there is an exception or not!
end
In the above example, if an action inside the try block fails, the build will not stop.
Try
some stuff that might raise an exception
Finally
run whether there is an exception or not!
end
In this example, the build would stop once the finally block has run.
HTH
Hi Mike
I agree, an ElseIf action would be useful, I'll see what we can do. Most probably it would just become an option on the existing If then action.
OK, sounds good.
What about the daisy-chain try that I suggested?
Right now it seems the only way to track a particular error without having to nest the Try blocks is to set a variable before each action and then put a Select structure in the Catch block. Hmm.. maybe you could make a generate variable that when you enter a Catch block it would contain information on the action that failed?
That will require some more lengthy R&D. I’ll discuss this with the team in the new year, we already have a pretty full schedule for Q1 though, so I can’t give you any idea when the R&D wll be done.
Seems that the second option in my request is similiar to a request made by Steve Bennett:
https://www.finalbuilder.com/forums.aspx?forumid=1&postid=2084&view=topic