Handling Http-Connector errors (technical error)

I have found that not all HTTP error codes are handled as a technical error for camunda… i.e a 404. Would the javascript below be an accurate approach to handle these codes so that if a 404 Camunda will create an incident ?

var statusCode = connector.getVariable(“statusCode”);
var headers = connector.getVariable(“headers”);

if (statusCode !== 200) {
throw new Error('Http-Connector error: ’ + statusCode + ’ - ’ + headers)
}
else {
S(response, ‘application/json’).data;
}

Hi Neil,

Could you explain further what do you want to achieve?

Best regards,
Yana

This is a workaround for handling the Service Task with HTTP Connector with JavaScript no response.
Try to change the endpoint of service to force the error handling.
test-service.bpmn (11.3 KB)

Here is the no workaroud way to resolve with Error Boudary Event:

if (statusCode != 200) {
    throw new org.camunda.bpm.engine.delegate.BpmnError("error-boundary-no-respose");
} else {
    S(response);
}


test-service-error-boundary-event.bpmn (9.2 KB)

I am facing the same issues. It seems none of the error codes are handled for http-connector. This should be mention in the documentation. Isn’t there any proper way to do so apart from workaround?

Regards,
Hetal