Expected Incident

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.

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.

1 Like

@Niall

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

thank you.
M.

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

thank you for the clarification