# Capturing Inner Exceptions in CurrentTransaction.CaptureException

**URL:** <https://discuss.elastic.co/t/capturing-inner-exceptions-in-currenttransaction-captureexception/270386>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [April 16, 2021, 12:27pm UTC](https://discuss.elastic.co/t/capturing-inner-exceptions-in-currenttransaction-captureexception/270386 "2021-04-16T12:27:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kbalys](https://avatars.discourse-cdn.com/v4/letter/k/8797f3/32.png) [@kbalys](https://discuss.elastic.co/u/kbalys)\
**Post date:** [April 16, 2021, 12:27pm UTC](https://discuss.elastic.co/t/capturing-inner-exceptions-in-currenttransaction-captureexception/270386/1 "2021-04-16T12:27:12Z")

</div>

Hi,

I am manually capturing exceptions during requests using the CaptureException method from ITransaction. I've noticed that it sores data only from the current exception but not the InnerException property. I extended the logic to capture also all inner exceptions and this seems to be working, however, as a result I have a list of errors which happened during transaction for which I am loosing the parent-child relation.

Am I doing this right? Should I call CaptureException for exception and all its inner exceptions or should this be done differently?

**.net core** : 3.1

**Agent version** : 1.7.1

**APM Server version** : 7.11.1

---

<div class="post-metadata">

**Author:** ![forloop](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/forloop/32/9021_2.png) [@forloop](https://discuss.elastic.co/u/forloop)\
**Post date:** [April 28, 2021, 3:31am UTC](https://discuss.elastic.co/t/capturing-inner-exceptions-in-currenttransaction-captureexception/270386/2 "2021-04-28T03:31:39Z")

</div>

Hi @kbalys,

The APM server spec defines a `"cause"` property that can be used to capture a chain of exceptions on the captured exception of an APM error.

At the moment, the .NET agent does not use this property, but we've opened [Capture Inner Exceptions on Error cause · Issue #1267 · elastic/apm-agent-dotnet · GitHub](https://github.com/elastic/apm-agent-dotnet/issues/1267) to implement in a future release.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [May 18, 2021, 11:32pm UTC](https://discuss.elastic.co/t/capturing-inner-exceptions-in-currenttransaction-captureexception/270386/3 "2021-05-18T23:32:32Z")

</div>

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.
