Difference btw. If-Prev-Action-Failed and Child Actions?

Hi!

As far as I understand, to execute some actions depending on whether an action succeeded or failed, I have these Options:

a) I must check Ignore Failure on an action or otherwise it'll raise an exception

b1) I can now add a If-Prev-Failed + Else block after the action, or

b2) I can add the actions I want to execute on success as Child Actions to the 1st action. (And maybe use an If-Prev-Failed block without Else)

Is there difference whether I use If-Prev-Failed-Else or just add a couple of Child Actions?

cheers, Martin

It’s pretty much the same. The other option is to put a try/catch block around the action. There are often many ways to achieve the same result for something in FinalBuilder.

Actually, now that I think about it, there is a difference, in that the If prev failed action executes it’s children, you know for sure the prev action failed. If you just add those same actions as children of the failing/ignored action, they will run whether the action failed or not, but you will not know what the result was.

If you just add those same actions as children of the failing/ignored action, they will run whether the action failed or not...
-- I'm confused: The children of an action are *only* run if the action succeeds, if the action fails (and has ignore-failure set) the the children will be skipped and the next action will be resumed. Correct?

Yes, but what that doesn’t give you is the ability to run some other actions only when that action fails. So if you want to run actions when the other action fails (with ignore set), use the If Prev action Failed action. If you only want to run actions when an action doesn’t fail, make them a child action.

In a scenario where an action is prone to failure and you don’t want to fail the build, my preference would be to use the Try/Catrch/Finally actions to control the error handling and what runs when. I think that makes the flow of the process easier to understand.

So if you want to run actions when the other action fails (with ignore set), use the If Prev action Failed action. If you only want to run actions when an action doesn't fail, make them a child action.
Excellent explanation, thanks! -- Allow me to suggest to put this sentence into the help of the If-Prev-Action-Failed action :-) --

keep up the great work!
- Martin