# Option to disable automatic error capturing

**URL:** <https://discuss.elastic.co/t/option-to-disable-automatic-error-capturing/303238>\
**Category:** APM\
**Tags:** nodejs\
**Created:** [April 26, 2022, 8:38am UTC](https://discuss.elastic.co/t/option-to-disable-automatic-error-capturing/303238 "2022-04-26T08:38:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mohamed\_jusail](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mohamed_jusail/32/100067_2.png) [@mohamed\_jusail](https://discuss.elastic.co/u/mohamed_jusail)\
**Post date:** [April 26, 2022, 8:38am UTC](https://discuss.elastic.co/t/option-to-disable-automatic-error-capturing/303238/1 "2022-04-26T08:38:26Z")

</div>

> <https://github.com/elastic/apm-agent-nodejs/issues/2658>
>
> \`\`try {
> throw new Error('Method not allowed');
> }catch(err) {
> apm.cap…tureError(err);
> res.send(500).json({message: err.message});
> }\`\`
> 
> Let's assume a scenario as above. In this scenario, there will be two errors logged in to the \`Elastic Discover\`. 
> 1. Error captured automatically by apm agent
> 2. Error captured by \`apm.captureError() \`method
> 
> In the Discover, those two errors will be logged as below.
> 
> !\[Screen Shot 2022-04-23 at 8 02 00 PM\](https://user-images.githubusercontent.com/38158937/164910414-bf6bbe14-922d-4652-98fb-56e09ba40167.png)
> 
> As displayed in this screenshot, there will be two errors logged. Among those two, one has the error message but other one doesn't. 
> 
> I think it would be better if there is an option to disable this automatic error capturing feature. If we capture the error using \`apm.captureError()\`method, there should be only one error logged in the Discovery.

---

<div class="post-metadata">

**Author:** ![trentm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/trentm/32/77647_2.png) [@trentm](https://discuss.elastic.co/u/trentm)\
**Post date:** [April 26, 2022, 3:50pm UTC](https://discuss.elastic.co/t/option-to-disable-automatic-error-capturing/303238/2 "2022-04-26T15:50:28Z")

</div>

Hi @mohamed_jusail. I've replied to Dulajdeshan on the GitHub issue.

---

<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 17, 2022, 11:51am UTC](https://discuss.elastic.co/t/option-to-disable-automatic-error-capturing/303238/3 "2022-05-17T11:51:11Z")

</div>

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