# Exception Handling in DUT on TestPlan Close

**URL:** <https://forum.opentap.io/t/exception-handling-in-dut-on-testplan-close/2679>\
**Category:** Technical\
**Created:** [June 9, 2026, 5:37am UTC](https://forum.opentap.io/t/exception-handling-in-dut-on-testplan-close/2679 "2026-06-09T05:37:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ky058](https://avatars.discourse-cdn.com/v4/letter/k/c4cdca/32.png) [@ky058](https://forum.opentap.io/u/ky058)\
**Post date:** [June 9, 2026, 5:37am UTC](https://forum.opentap.io/t/exception-handling-in-dut-on-testplan-close/2679/1 "2026-06-09T05:37:49Z")

</div>

We’ve implemented a custom DUT and overridden the `Close` method. When the test plan is closed, there are cases where errors occur during DUT shutdown and we throw exceptions. However, it seems that these exceptions are not propagated when closing the test plan.

Are these exceptions being swallowed in this scenario?

My goal is to ensure our custom GUI is notified of any exceptions so we can apply specific handling. Is there a recommended way to reliably capture and report these exceptions?

---

<div class="post-metadata">

**Author:** ![rolf\_madsen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rolf\_madsen](https://forum.opentap.io/u/rolf_madsen)\
**Post date:** [June 10, 2026, 10:57am UTC](https://forum.opentap.io/t/exception-handling-in-dut-on-testplan-close/2679/2 "2026-06-10T10:57:01Z")

</div>

Hi @ky058 ,

Currently, the only notification you can get is via the log - there will be an error and a stack trace. So you can capture and report the data from the log, but I am guessing you are looking for something else.

MaybeTestPlanRun object should hold the exceptions and other related data.

Could you elaborate a bit on how you would like to use this data?

---

<div class="post-metadata">

**Author:** ![scottri](https://avatars.discourse-cdn.com/v4/letter/s/a4c791/32.png) [@scottri](https://forum.opentap.io/u/scottri)\
**Post date:** [June 12, 2026, 5:24am UTC](https://forum.opentap.io/t/exception-handling-in-dut-on-testplan-close/2679/3 "2026-06-12T05:24:38Z")

</div>

If you desire is to somehow make the test fail, you need to get the exception to occur before the end of the tapplan, such as, add a step that effectively performs the exception throwing DUT functionality early before the end of the tapplan.
