# Generic error event handler

**URL:** <https://forum.camunda.io/t/generic-error-event-handler/36477>\
**Category:** Discussion & Questions\
**Created:** [March 11, 2020, 3:31pm UTC](https://forum.camunda.io/t/generic-error-event-handler/36477 "2020-03-11T15:31:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![pmccolgan](https://forum.camunda.io/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@pmccolgan](https://forum.camunda.io/u/pmccolgan)\
**Post date:** [March 11, 2020, 3:31pm UTC](https://forum.camunda.io/t/generic-error-event-handler/36477/1 "2020-03-11T15:31:57Z")

</div>

I’m wondering if the following is possible:

 ![Screenshot 2020-03-11 at 15.18.29](https://forum.camunda.io/uploads/default/original/1X/5d2f699311b2647a07d9a680ca753c152ffe382c.png)

I would like to be able to define one service task that can handle defined boundary event errors and process them based on their error code.

But from using the Zeebe C# Client and reading the docs I can’t see:

- where the error code would be available within the Generic Error Handler service task?  
or
- how the process variables could be updated to include the error code before it is thrown in Step 1 or Step 2?  
or
- if there’s just a better approach within zeebe?

Thanks

---

<div class="post-metadata">

**Author:** ![Philipp\_Ossler](https://forum.camunda.io/user_avatar/forum.camunda.io/philipp_ossler/32/25299_2.png) [@Philipp\_Ossler](https://forum.camunda.io/u/Philipp_Ossler)\
**Post date:** [March 12, 2020, 6:38am UTC](https://forum.camunda.io/t/generic-error-event-handler/36477/2 "2020-03-12T06:38:34Z")

</div>

Hi @pmccolgan,

currently, it is not possible to store the error code of the caught error event in a workflow instance variable. Also, it is not possible to catch any error event unrelated to its error code using one error catch event.

I see that this could be useful. Feel free to open a new feature request.

However, you can model this also in the following way:

 ![image](https://forum.camunda.io/uploads/default/original/1X/9ffe00b5affaaa9255678e3407dd4c4762aeec74.png)

- multiple error event subprocesses / error boundary events - one for each error code
- one generic error handler task
- the task has a custom header `errorCode` that is set to the error code of the error catch event

Does this help you?

Best regards,  
Philipp

---

<div class="post-metadata">

**Author:** ![pmccolgan](https://forum.camunda.io/letter_avatar_proxy/v4/letter/p/e79b87/32.png) [@pmccolgan](https://forum.camunda.io/u/pmccolgan)\
**Post date:** [March 12, 2020, 11:40pm UTC](https://forum.camunda.io/t/generic-error-event-handler/36477/3 "2020-03-12T23:40:53Z")

</div>

Thank you @philipp.ossler what you proposed there works perfectly for me, I was unaware of the headers I could apply and hadn’t considered re-using the same service task in multiple sub processes but that’s exactly how I’ve done it and it works.

---

<div class="post-metadata">

**Author:** ![system](https://forum.camunda.io/uploads/default/original/3X/5/8/58d50142eacca605d35cb1ef9e6b86ae85f49436.png) [@system](https://forum.camunda.io/u/system)\
**Post date:** [January 31, 2024, 10:10am UTC](https://forum.camunda.io/t/generic-error-event-handler/36477/4 "2024-01-31T10:10:31Z")

</div>

Closed on January 31, 2024, 10:10am UTC


