# Expected Incident

**URL:** <https://forum.camunda.io/t/expected-incident/10182>\
**Category:** Discussion & Questions\
**Tags:** process-engine\
**Created:** [December 12, 2018, 7:02pm UTC](https://forum.camunda.io/t/expected-incident/10182 "2018-12-12T19:02:51Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michal\_S](https://forum.camunda.io/letter_avatar_proxy/v4/letter/m/779978/32.png) [@Michal\_S](https://forum.camunda.io/u/Michal_S)\
**Post date:** [December 12, 2018, 7:02pm UTC](https://forum.camunda.io/t/expected-incident/10182/1 "2018-12-12T19:02:51Z")

</div>

Hi dear Camunders,

Today I have tried to make an incident for service task which connects to Oracle database.  
My class is usuall class which has the follwing for catching exceptions:

```
public class SendNotificaton implements JavaDelegate {
    	
    	public void execute(DelegateExecution execution) throws Exception {
    .
    .
    .
    	} catch (SQLException e) {
    System.out.println(getCurrentTimeStamp()+ " Error Cycle DB details: " + e.getMessage() + " stack trace:" + e.getStackTrace() + " localized message:" + e.getLocalizedMessage() + " getErrorCode:" + e.getErrorCode() );

```

.  
.  
.  
it gives me valid exception

14:33:21 Error Cycle DB details: IO Error: The Network Adapter could not establish the connection stack trace:[Ljava.lang.StackTraceElement;@612e4a6e localized message:IO Error: The Network Adapter could not establish the connection getErrorCode:17002

which is expected.

The thing is that I am not getting any incident in camunda for such exception and in cockpit it seems the task was executed successfully, (service task is async before and after.).

thank you for any suggestions about what I am implementing in a wrong way.

M.

---

<div class="post-metadata">

**Author:** ![Niall](https://forum.camunda.io/user_avatar/forum.camunda.io/niall/32/15333_2.png) [@Niall](https://forum.camunda.io/u/Niall)\
**Post date:** [December 12, 2018, 7:15pm UTC](https://forum.camunda.io/t/expected-incident/10182/2 "2018-12-12T19:15:19Z")

</div>

If you catch the error in the code the engine won’t be able to catch it.  
You need to throw it again, if the engine catches the error it’ll create an incident.

---

<div class="post-metadata">

**Author:** ![Michal\_S](https://forum.camunda.io/letter_avatar_proxy/v4/letter/m/779978/32.png) [@Michal\_S](https://forum.camunda.io/u/Michal_S)\
**Post date:** [December 12, 2018, 7:42pm UTC](https://forum.camunda.io/t/expected-incident/10182/3 "2018-12-12T19:42:40Z")

</div>

@Niall

If I understand it correctly that means to throw classic BPMN error or custom Incident handler

thank you.  
M.

---

<div class="post-metadata">

**Author:** ![Niall](https://forum.camunda.io/user_avatar/forum.camunda.io/niall/32/15333_2.png) [@Niall](https://forum.camunda.io/u/Niall)\
**Post date:** [December 12, 2018, 7:46pm UTC](https://forum.camunda.io/t/expected-incident/10182/4 "2018-12-12T19:46:58Z")

</div>

If you throw a BPMN error it could be potentially caught be an error catch event. Any other unhandled error will create an incident.

---

<div class="post-metadata">

**Author:** ![Michal\_S](https://forum.camunda.io/letter_avatar_proxy/v4/letter/m/779978/32.png) [@Michal\_S](https://forum.camunda.io/u/Michal_S)\
**Post date:** [December 12, 2018, 7:48pm UTC](https://forum.camunda.io/t/expected-incident/10182/5 "2018-12-12T19:48:37Z")

</div>

thank you for the clarification

---

<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 30, 2024, 11:29am UTC](https://forum.camunda.io/t/expected-incident/10182/6 "2024-01-30T11:29:22Z")

</div>

Closed on January 30, 2024, 11:29am UTC


