# Try/Catch in For loop error trapping

**URL:** https://www.finalbuilder.com/forums/t/try-catch-in-for-loop-error-trapping/3163
**Category:** Bugs
**Created:** [October 15, 2009, 2:58am UTC](https://www.finalbuilder.com/forums/t/try-catch-in-for-loop-error-trapping/3163 "2009-10-15T02:58:54Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [October 15, 2009, 2:58am UTC](https://www.finalbuilder.com/forums/t/try-catch-in-for-loop-error-trapping/3163/1 "2009-10-15T02:58:54Z")

</div>

Hi everyone.  
  
I noticed some issues with Try/Catch when beeing used within a For loop.&nbsp;The screenshot attached shows my current actions.  
  
1)&nbsp;The Try/Catch is putting the error into a variable. For the second and third loop (only 3 done), the error gets appended to the variable. I think we should be able to choose between appending or setting the vraible to the value.  
  
2)&nbsp;With the same test, I also notifced that VSS warnings gets trapped by the catch (ie&nbsp;:&nbsp;All responsed "Yes" questions from&nbsp;VSS).&nbsp;Would it be hard to modify so we can choose either to log warnings, erros or both from the VSS&nbsp;Get Latest&nbsp;Version action ?  
  
Thanks again for great service

![TRY_CTACH_Error1.PNG.jpg](https://www.finalbuilder.com/forums/uploads/default/original/2X/f/febc83be7505400b8f2865f40f1a66fb763636dd.jpeg)

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [October 21, 2009, 3:08am UTC](https://www.finalbuilder.com/forums/t/try-catch-in-for-loop-error-trapping/3163/2 "2009-10-21T03:08:02Z")

</div>

The error variable being appended to was actually a bug in the base action class that wasn’t resetting when run in a loop. This build contains the fix :   
  
 [https://www.finalbuilder.com/downloads/finalbuilder/630/FB630\_1773.exe](https://www.finalbuilder.com/downloads/finalbuilder/630/FB630_1773.exe)

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [October 21, 2009, 5:47am UTC](https://www.finalbuilder.com/forums/t/try-catch-in-for-loop-error-trapping/3163/3 "2009-10-21T05:47:00Z")

</div>

Thank you .  
  
I will test it late this afternoon. I'll mark it as "Resolved" since the fixes are usually well made !  
  
Should I repost #2 to "Wish list"&nbsp;?

---

<div class="post-metadata">

### Author: ![Vincent](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/vincent/32/938_2.png) [@Vincent](https://www.finalbuilder.com/forums/u/Vincent)
#### Post date: [October 21, 2009, 10:43am UTC](https://www.finalbuilder.com/forums/t/try-catch-in-for-loop-error-trapping/3163/4 "2009-10-21T10:43:19Z")

</div>

Can you post the log for the VSS Action and also what is showing up in the Errors variable? I had a quick look at the action but I couldn’t see why this would happen.
