Error handling

Hello,

I would like to handle the error of the job http (GitHub - camunda-community-hub/zeebe-http-worker: Zeebe worker for HTTP calls) but the error is not catch by the error boundary event.

image

I have read the documentation on error handling without success.

camunda version : 8.0.2
modeler 5.0.0

Thank you in advance.

Do you have the errorCodePath header set in the Worker Activity?
The Github links shows that if this error is found, it will throw a BPMN error, rather than failing. The Job Fail isn’t a BPMN error, but a technical error, which is why it’s not getting caught.

You can think of this as similar to a try…catch
try {

} catch BusinessError {

}

But, since the worker is throwing TechnicalError, the process doesn’t go down your catch block.

1 Like

Thank you,

I found also a bug in the http-worker if you errorcode is an int value like 404. For example if my spring boot api return ResponseEntity(HttpSatatus.BAD_REQUEST);

the parser fail and the returned value is null. For fix this you can replace the method extractPath :

  private Optional<String> extractPath(String body, JsonPointer pointer) {
    try {
      JsonNode valueNode = objectMapper.readTree(body).at(pointer);
      if (valueNode.isValueNode()) {
        return Optional.ofNullable(valueNode.asText());
      }
      return Optional.ofNullable(valueNode.textValue());
    } catch (IOException e) {
      return Optional.empty();
    }
  }

the code check the type for parse in the correct way.