Custom Exception Handling

I need to be able to return custom json as response to a process start rest request, so that i can return errors of the parameter validation.

I think custom exception handling is a pretty essential feature for cases such as this and it should be part of Camunda. See: https://app.camunda.com/jira/browse/CAM-7525?jql=text%20~%20"rest%20error"

I have a service task to validate my data right after the start event, which would then throw the exception. (not async)

Question:
I also read that you could use jax-rs mappers as a workaround in another old thread. Where would i put my jax-rs mapper class - within my spring boot application or within a standalone jar which i place in tomcat/lib?
Or how does this work?

Kind Regards,
Philipp Heuer

2 Likes

Hi,

If you use withVariablesInReturn [1], you can return an error condition to a calling client. Hence on exception, create two process variables, eg ERROR and ERROR_MESSAGE. Populate these with content and ensure the client looks for them in the returned payload. If present, there was an error, if not, then all was ok.

regards

Rob

[1] https://docs.camunda.org/manual/7.7/reference/rest/process-definition/post-start-process-instance/#request-body

1 Like