im trying to start a process using the rest api and want to implement my variable validation in the first service task.
I persist my process after the validation. How can i throw an Exception that the client recieves when he starts the process with invalid variables instead of the success response?
TL;DR: I want to throw an exception that the rest client recieves as application/json and not as html. (When starting the process using rest)
Its a workaround and requires some parsing to read the error message. What i have done in create a script task that does a check on the variables, and throw a error if the variables are not found.
Thanks for the idea. I’m now throwing a RuntimeException (like you) and attach a json response after the :. I will just have to do some regex magic to get my real json - it’s working
But it would be nice if we could add support for this in the camunda engine.