# Handling Partial Failure in a Tree (Need Code Structure Ideas)

**URL:** https://www.finalbuilder.com/forums/t/handling-partial-failure-in-a-tree-need-code-structure-ideas/840
**Category:** Discussion
**Created:** [May 8, 2008, 8:52am UTC](https://www.finalbuilder.com/forums/t/handling-partial-failure-in-a-tree-need-code-structure-ideas/840 "2008-05-08T08:52:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![rlove](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/rlove/32/27_2.png) [@rlove](https://www.finalbuilder.com/forums/u/rlove)
#### Post date: [May 8, 2008, 8:52am UTC](https://www.finalbuilder.com/forums/t/handling-partial-failure-in-a-tree-need-code-structure-ideas/840/1 "2008-05-08T08:52:04Z")

</div>

We currently build all of our packages in a list, if one fails the entire build fails.&nbsp;&nbsp;&nbsp; We would like to move to a system where the failure is noted, but it continues on trying to build any packages that were not dependant on the one that failed.&nbsp;&nbsp; Allowing us to see more than one build failure at a time.

Example:

Package1.bpl (Depends only on&nbsp;packages already compiled)  
&nbsp;&nbsp;&nbsp; Package2.bpl Depends on Package1.bpl  
&nbsp;&nbsp;&nbsp; Package3.bpl&nbsp;Depends on Package3.bpl  
Package4.bpl (Depends only packages already compiled)  
Package5.bpl (Depends only packages already compiled)  
&nbsp;&nbsp;&nbsp; Package6.bpl&nbsp;Depends on Package5.bpl  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Package7.bpl&nbsp;Depends on Package6.bpl  
&nbsp;&nbsp;&nbsp; Package8.bpl&nbsp;Depends on Package3.bpl  
  
  
If I start the build and Package1.bpl Fails, I would like it to not try to build 2 or 3, but continue on and build 4,5,6,7, and 8.

Then when complete trying the entire tree, It would like to Fail the build. So I can send an email saying... Package 1 failed (and possibly others)

Although I have not used the Stack actions, I think they may work well for handling logging the errors and handling each when failing.  
  
The tree functionality of not building 2 and 3 when 1 fails might be a not be realisitc, but I thought I would post here for some ideas just incase I have missed some build in functionality.

&nbsp;

&nbsp;

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

### Author: ![tate](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@tate](https://www.finalbuilder.com/forums/u/tate)
#### Post date: [May 9, 2008, 2:29am UTC](https://www.finalbuilder.com/forums/t/handling-partial-failure-in-a-tree-need-code-structure-ideas/840/2 "2008-05-09T02:29:47Z")

</div>

Hi Robert,   
  
This is my suggestion:   
  
try   
&nbsp;&nbsp;&nbsp;&nbsp; Package1.bpl (Depends only on packages already compiled) [Log to variable: FailureMsg]   
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Package2.bpl Depends on Package1.bpl [Log to variable: FailureMsg]   
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Package3.bpl Depends on Package3.bpl [Log to variable: FailureMsg]   
catch   
&nbsp;&nbsp;&nbsp;&nbsp; Record error in variable or file or send email, eg. "Error occurred in Package1-3: %FailureMsg%"   
end   
try   
&nbsp;&nbsp;&nbsp;&nbsp; Package4.bpl (Depends only packages already compiled) [Log to variable: FailureMsg]   
catch   
&nbsp;&nbsp;&nbsp;&nbsp; Record error in variable or file or send email, eg. "Error occurred in Package5: %FailureMsg%"   
end   
try   
&nbsp;&nbsp;&nbsp;&nbsp; Package5.bpl (Depends only packages already compiled) [Log to variable: FailureMsg]   
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Package6.bpl Depends on Package5.bpl [Log to variable: FailureMsg]   
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Package7.bpl Depends on Package6.bpl [Log to variable: FailureMsg]   
&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; Package8.bpl Depends on Package3.bpl [Log to variable: FailureMsg]   
catch   
&nbsp;&nbsp;&nbsp;&nbsp; Record error in variable or file or send email, eg. "Error occurred in Package5-8: %FailureMsg%"   
end   
  
The catches will handle the error condition, and allow the build to continue on.

---

<div class="post-metadata">

### Author: ![rlove](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/rlove/32/27_2.png) [@rlove](https://www.finalbuilder.com/forums/u/rlove)
#### Post date: [May 15, 2008, 12:38pm UTC](https://www.finalbuilder.com/forums/t/handling-partial-failure-in-a-tree-need-code-structure-ideas/840/3 "2008-05-15T12:38:50Z")

</div>

Thank you I will try that.&nbsp;&nbsp;
