Dear community,
I have a start process web api, the process is updating the metadata table.
My facing issue is that API response success even when write to data store entity error.
The expected result should be when process executing error, we can expose the process instance error in web api response body.
Therefore, how can I get the process instance error? then I can save it into process variable, and in the api, we can get it through ProcessInfo.
Thanks in advance for your answers.
Discussion posts and replies are publicly visible
a!startProcess() has two parameters which help, onSuccess and onError. onError happens when a node in the process model runs into an execution error and onSuccess happens when the activity chaining for you process completes and none of those nodes hit an error. For your use case, it seems like you need to add an a!httpResponse() in the onError parameter.
In my case, when write to data store entity node encounter error, a!startProcess still response success code 200, it didn't flow into onError condition, that's why I have this asking.
Did you enable chaining at least up to that node?
BTW, why does this node fail in the first place?
Yes, I have enabled activity chaining for the whole process paths.
Why the node failed? it's because the request data passed the incorrect date format, when insert into DB, process instance show below error:
" com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: '292269055-12-02 16:47:04.194' for column 'DUE_DATE' at row ....."
OK. The first rule when implementing APIs is: Do not trust incoming data! I recommend to check and validate the data before trying to write it to DB. This allows you to return any error messages you like. A failed process is no proper error handling.
If there is no way to capture this kind of data for failed process, I will go into this way that validate data and give customized response before start process. Many thanks Stefan~